cancel
Showing results for 
Search instead for 
Did you mean: 

Email is not sent

Former Member
0 Kudos

Hi,

My requirement is to send out email upon first time saving of the lead.

However, the email is not sent out to the recipient, even though the email activity is created (see the screen shot).

Any idea?

Here is my codes in event-beforesave of the lead BO extension.

var elActivityRootEmail :  elementsof Activity;

var instActivityEmail;

// Activity: define party node

var elActivityPartyEmail : elementsof Activity.Party;

var instPartyEmail;

// Activity: define text collection

var elActivityTxtCollTxtEmail:      elementsof Activity.TextCollection.Text;

var elActivityTxtCollTxtCntntEmail: elementsof Activity.TextCollection.Text.TextContent;

var instActivityTxtCollEmail;

var instActivityTxtCollTxtEmail;

// Activity: define attachment folder

var elActivityAttachmDoc:      elementsof Activity.AttachmentFolder.Document;

var instActivityAttachm;

instActivityEmail = Activity.CreateWithReference(this, "39");

instActivityEmail.SubjectName= "Test email";

elActivityPartyEmail.PartyName = "0001000843";

instActivityEmail.MessageToParty.Create(elActivityPartyEmail);

instActivityTxtCollEmail = instActivityEmail.TextCollection.Create();

elActivityTxtCollTxtEmail.TypeCode.content = "10002";

instActivityTxtCollTxtEmail = instActivityTxtCollEmail.Text.Create(elActivityTxtCollTxtEmail);

elActivityTxtCollTxtCntntEmail.Text.content = "Body text of the Activity Email";

instActivityTxtCollTxtEmail.TextContent.Create(elActivityTxtCollTxtCntntEmail);

instActivityEmail.Send(); 

cheers,

julius

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi julius,

Code looks fine and I don't see any cliches on the code. Anyways for my convinience sake could you please use the below code and try this out

//Elements of Email

var emailActivityElements : elementsof EmailActivity;

var emailActivityMessageFromPartyElements : elementsof EmailActivity.Party;

var emailEmployeeResponsiblePartyElements : elementsof EmailActivity.Party;

var emailActivityCC : elementsof EmailActivity.Party;

var emailAcitivtyTo : elementsof EmailActivity.Party;

var emailActivityEmailActivity : elementsof EmailActivity.Party;

var emailActivityTextCollText : elementsof EmailActivity.TextCollection.Text;

var emailActivityTextCollTextTextCont : elementsof EmailActivity.TextCollection.Text.TextContent;

var employeeMailID;

var employee;

var employeeAdminMailID;

var emailActivityInstance;

employee = Employee.Identification.Retrieve(notification.Source);

if (employee.IsSet())

{

    if (employee.ToParent.CurrentDefaultEmployeeWorkplaceAddressInformation.IsSet())

    {

          var employeeWorkPlaceAddressInfo = employee.ToParent.CurrentDefaultEmployeeWorkplaceAddressInformation;

          if (employeeWorkPlaceAddressInfo.EmployeeWorkplaceAddressWorkplaceAddress.IsSet())

          {

                employeeMailID = employeeWorkPlaceAddressInfo.EmployeeWorkplaceAddressWorkplaceAddress.DefaultEMail.URI.content;

          }

      }

}

    //For display the subject accordingly

 

        emailActivityElements.Name.content = "Reg: Test Email";

        emailActivityInstance = EmailActivity.Create(emailActivityElements);

    // for assigning the To Party

    if (!employeeMailID.IsInitial())

    {

        emailAcitivtyTo.PartyKey.PartyID.content = employeeMailID;

        emailActivityInstance.MessageToParty.Create(emailAcitivtyTo);

    }

    else

    {

        raise Error/Info Messgaes accordingly

    }

    //TextCollectionTextTypeCode 10002 -> Body Text

    var TxtTypeCode = "10002";

    var emailActivityTxtCollIns = emailActivityInstance.TextCollection.Create();

    emailActivityTextCollText.TypeCode.content = TxtTypeCode;

    var emailActivityTxtCollTxtIns = emailActivityTxtCollIns.Text.Create(emailActivityTextCollText);

  

    //To Display the Message Note

        

        emailActivityTextCollTextTextCont.Text.content = "Dear Recipient," + "\n \n" +

        "Text Needed ";

    var emailActTxtCollTxtTxtCont = emailActivityTxtCollTxtIns.TextContent.Create(emailActivityTextCollTextTextCont);

    //If Instance is Set then Send the mail

    if (emailActivityInstance.IsSet())

    {

        emailActivityInstance.Send();

    }

This should work.

Before testing this please make sure the domain names are added, if not fine tune the project and add them domain names and also see whether email are sent to the business users or to a single person (Static Email will be maintained and only that email id will be picked up by system for every email activity).

Regards

Hanu

Former Member
0 Kudos

Hi Hanu,

Thanks for the reply.

Same problem. Email is not sent, while email activity is created.

Added the domain.

Does it matter if the email sending is trigger in event beforesave in lead extension bo?

julius

Former Member
0 Kudos

Julius,

Added Domain,still you were not able to send a mail. Your email domain only you added right like lets say julius@testdomain.com. So this case @testdomain.com will be the domain.

It will not matter if the Before Save script is used, I did it many time form the same script but in Business ByDesign not in C4C, but it shouldn't really matter with the product using as long as for these both product studio is same.

Can you just check the other option as specified in my previous comment that whether Email option is configures that to be recieved by the business users or only by one static email id.

Regards

Hanu

Former Member
0 Kudos

I agree with Hanumath, it should be a business configuration issue if the email object is created.

Answers (0)