on 08-19-2014 2:17 PM
Hello Experts,
We are trying to email from the Event-BeforeSave of our BusinessPartner extension object. Emailing seems to work just fine (plain text or PDF attachment), until the moment we add HTML content.
This is the code that we currently are using:
// create email activity
elEmailRoot.Name.content = "Test HTML";
instEmail = EmailActivity.Create(elEmailRoot);
// add receiver
elEmailParty.PartyKey.PartyID.content = "<myemail>";
instEmail.MessageToParty.Create(elEmailParty);
//Create att folder
instEmailAttFld = instEmail.AttachmentFolder.Create();
//Add attachment (html body)
docName = "body.html";
doctype.content = "10001";
binaryObject.mimeCode = "text/html";
//binaryObject.content = Binary.ParseFromString( resultData.GetFirst().EmailTemplate );
binaryObject.content = Binary.ParseFromString("<html><head></head><body><div>test</div></body></html>");
instEmailAttFld.CreateFile(doctype, docName, docAltName, docDesc, binaryObject);
// send email
instEmail.Send();
Is there an error within my code or is it possible that the system is blocking HTML email? Thanks for your help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alessandro,
I can confirm that with SDK 1408 the following code works:
elActivityRoot.TypeCode = "39"; // create Email
elActivityRoot.SubjectName = "Subject";
instActivity = Activity.Create(elActivityRoot);
elActivityParty.PartyName = "test@email.com";
instActivity.MessageToParty.Create(elActivityParty);
// Create a text of type "Body Text"
instActivityAttachm = instActivity.AttachmentFolder.Create();
elActivityAttachmDoc.VisibleIndicator = true;
elActivityAttachmDoc.MIMECode = "text/html";
elActivityAttachmDoc.Name = "body.html";
elActivityAttachmDoc.AlternativeName = "body.html";
elActivityAttachmDoc.CategoryCode = "2";
elActivityAttachmDoc.TypeCode.content = "10001";
instActivityAttachm.Document.Create(elActivityAttachmDoc);
var bin = Binary.ParseFromString( "<html><head></head><body><div>test <strong>HTML</strong>mail</div></body></html>" );
var doc = instActivityAttachm.Document.GetFirst();
var filecontent = doc.FileContent.Create();
filecontent.BinaryObject.content = bin;
instActivity.Send();
Thanks for your input!
Hi R. Albers,
We have a requirement to provide a button in Appointments and on click of it an email has to be sent out to all the parties involved. For this, we have created a custom BO with a send email action. This action contains the code exactly the same as quoted here. Also, the studio version is 1408. But when the execution reaches instActivity.Send() statement, a dump is being raised. The custom BO binding to the Activity BO is working fine.
We also tried explicitly mentioning a personal gmail email ID but in vain. Any suggestions where we might be wrong ?
Any help will be highly appreciated. Thanks.
Regards
Shruti
Hi, you can't create an activity from an activity (also if they are different type like appointment and email).
You are inside an appointment and you are trying to create an email activity.
To solve the problem you need to create a webservice and to call this WS from your session. It will create a completely new detached session and it will work.
Regards
Hi Alessandro,
Thank you for your valuable response.
I downloaded the email activity inbound WSDL from communication arrangements and tried creating an external web service definition for this WSDL but failed. It gives me the following error:
The further plan after creating the external WS definition was to call its create method from my session.
Can you please suggest where am I going wrong ? and also provide me with some detailed insight into this issue ?
Regards
Shruti
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.