Results 1 to 6 of 6

Thread: Adding a CC and/or BCC field to automatic Emails

  1. #1
    bcarson76 is offline Member
    Join Date
    Nov 2010
    Posts
    6

    Default Adding a CC and/or BCC field to automatic Emails

    Hello all,

    I have been searching the forums, unsucessfully, for about a day now. I need to set up the Cases subpage so that when a new case is added, or details about an existing case change, not only is the assigned user emailed, but a second email address is sent to the manager of the dept.

    Now, I could set this up so that each person's email also cc's the manager, but we are only concerned about support issues relating to accounts.

    Not knowing much about PHP, I wouldn't even know where to start looking in the source files.

    THanks for any advice you can give.

    Brian Carson
    IT Manager
    BPS Worldwide

  2. #2
    davidboris is offline Sugar Community Member
    Join Date
    May 2010
    Posts
    1,113

    Default Re: Adding a CC and/or BCC field to automatic Emails

    Hello,

    If I'm not mistaken, you want to send notification email to Manager of assigned to user when the record is first created. If yes, you can achieve such by writing own logic hook which will fetch email address of Manager and sends out email to him.
    Thumbs up.

    Skype ID - david__boris

    SugarForge Projects:

    WYSIWYG now in studio!(Version 1.1 is out now!)

    Sugar Feeds on your personalized home pages like iGoogle, My Yahoo!, etc.

    Fab Tools! > Dashlet Not Followed Opportunities for past six Months

  3. #3
    bcarson76 is offline Member
    Join Date
    Nov 2010
    Posts
    6

    Default Re: Adding a CC and/or BCC field to automatic Emails

    David,

    That is close, but not quite what I need. Since everyone has the same manager in this setup, I do not need to fetch it from the employee record. All I need to do is add his email address, as a cc field, to the php script.

    My real issue is that I am in no way a php guy, so 1) I do not know where to look, and 2) even if I found the right page to modify, I wouldn't know what to do...

    That is where I was hoping this board would come in. If you say: Open this file in this folder, go to line ### and add the following. I can do that. But saying "add a logic hook" is meaningless to me

    Thanks.

  4. #4
    davidboris is offline Sugar Community Member
    Join Date
    May 2010
    Posts
    1,113

    Default Re: Adding a CC and/or BCC field to automatic Emails

    Hello,

    First of all, what code I am pasting here is total un-upgrade safe. Which means, next time you do upgrade your SugarCRM version, the changes will be overwritten. 2 ways, you write logic hook(which is impossible for you) and second, each time you upgrade the system, without fail, write this change again.

    open data/SugarBean.php and go to line # 1619(as in version CE 6.1GA) and see if you have if($sendEmail && !$notify_mail->Send()) { on line # 1620, if not search for the same line and right above that, paste code below

    PHP Code:
    $ccUser = new User(); 
    $ccUser->retrieve(<USER_ID>);
    $notify_mail->AddCC($ccUser->emailAddress->getPrimaryAddress($ccUser)); 
    Now, change <USER_ID> to the ID of the manager user.
    Thumbs up.

    Skype ID - david__boris

    SugarForge Projects:

    WYSIWYG now in studio!(Version 1.1 is out now!)

    Sugar Feeds on your personalized home pages like iGoogle, My Yahoo!, etc.

    Fab Tools! > Dashlet Not Followed Opportunities for past six Months

  5. #5
    bcarson76 is offline Member
    Join Date
    Nov 2010
    Posts
    6

    Default Re: Adding a CC and/or BCC field to automatic Emails

    David,

    Thank you for this code, unfortunately, it does not work, and actually prevents Sugar from doing any notification emails as long as it is in place. I did as you said, and found line 1619, then pasted the following code right above it:

    $ccUser = new User();
    $ccUser->retrieve(bcarson);
    $notify_mail->AddCC($ccUser->emailAddress->getPrimaryAddress($ccUser));

    Tried it, and it failed. So I tinkered some. I noticed right above that was an if else block, so I tried putting the code into both of those blocks and it again failed.

    I guess I will start reading up on how to write logic hooks.

  6. #6
    davidboris is offline Sugar Community Member
    Join Date
    May 2010
    Posts
    1,113

    Default Re: Adding a CC and/or BCC field to automatic Emails

    Hello,

    You need to provide 36 char unique ID for user bcarson(found in users table) instead of username.
    Thumbs up.

    Skype ID - david__boris

    SugarForge Projects:

    WYSIWYG now in studio!(Version 1.1 is out now!)

    Sugar Feeds on your personalized home pages like iGoogle, My Yahoo!, etc.

    Fab Tools! > Dashlet Not Followed Opportunities for past six Months

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Help with automatic emails sent by workflow
    By antonio.cuccu in forum Developer Help
    Replies: 2
    Last Post: 2009-09-02, 04:04 PM
  2. Automatic BCC for outgoing Emails
    By GergelyM in forum Help
    Replies: 2
    Last Post: 2009-03-10, 03:10 PM
  3. How to: set automatic rules for invalid emails
    By leticia.filomeno in forum General Discussion
    Replies: 1
    Last Post: 2008-09-30, 12:26 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •