on 02-12-2018 4:29 PM
Hi,
I've been following a blog on here, trying to get an email sent to myself via ABSL and it's not arriving, despite the test email (from business config) arriving. My code's as below, with identifiers such as the email addresses obfuscated:
import ABSL;
import AP.FO.Activity.Global;
import AP.Common.GDT as gdt;
import BASIS.Global;
import DocumentServices.Global;
var elementsofEmailActivity: elementsof EmailActivity;
var newEmail;
//EmailActivity: define party node.
var elementsofEmailActivityParty: elementsof EmailActivity.Party;
var instParty;
var textCollectionTypeCode = "10002";
var elementsofTextCollectionText: elementsof EmailActivity.TextCollection.Text;
var elementsofTextContent: elementsof EmailActivity.TextCollection.Text.TextContent;
var newTextCollection;
var newTextCollectionText;
//elementsofEmailActivity.Name.content = "Customer Invoice"; //The email subject.
//elementsofEmailActivity.Name.content = this.EmailSubject.Concatenate(" (Invoice ").Concatenate(this.InvoiceNumber.content.RemoveLeadingZeros()).Concatenate(")");
elementsofEmailActivity.Name.content = "Testing";
newEmail = EmailActivity.Create(elementsofEmailActivity);
elementsofEmailActivityParty.PartyKey.PartyID.content = "email@address.co.uk"; //The email address where you want to send it.
newEmail.MessageToParty.Create(elementsofEmailActivityParty);
newEmail.MessageFromParty.PartyKey.PartyID.content = "DoNotReply@myxxxxxx.mail.sapbydesign.com";
var employeeResponsibleParty = newEmail.EmployeeResponsibleParty;
if (!employeeResponsibleParty.IsSet())
{
newEmail.EmployeeResponsibleParty.Create();
}
if (employeeResponsibleParty.IsSet())
{
employeeResponsibleParty.PartyKey.PartyID.content = "7000001";
}
newEmail.Send();
What's going wrong? The domain 'myxxxxxx.mail.sapbydesign.com' has been added to the list of sending domains allowed in E-mail and Fax Settings. My email address is the one used for all output in the system. If I send a test email it arrives, but not my one. What's going on?
Lewis
Hi Lewis,
The BO EmailActivity, we just can do send email from the login user.
newEmail = EmailActivity.Create(elementsofEmailActivity);
elementsofEmailActivityParty.PartyKey.PartyID.content = "8000000021"; //To email partner ID
newEmail.MessageToParty.Create(elementsofEmailActivityParty);
newEmail.MessageFromParty.PartyKey.PartyID.content = "8000000000"; //login user partner ID
Another way: use the Mail.Send, it can set the "From" and "To" email address.
Best Regards,
Benny Huang
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Benny,
I got this working, sort of. The email arrives (it turns out that I needed to comment out the 'message from' lines and add the domain of the email associated with my user, which wasn't the myxxxxxx.mail.sapbydesign.com one), but the PDFs that get attached during my code aren't getting opened because there's a problem with them. It's SAP's own code to generate and attach files, so I'm wondering why.
Lewis
////20180111 change from the object preview
//if(mail_template.AttachInvoices == true)
//{
//var attachment : pe:Attachment;
//
//if (ci.ProcessingTypeCode == "CCM")
//{
//attachment.FileName="Customer Credit Memo "+ci.ID.content+".pdf";
//}
//else if(ci.ProcessingTypeCode == "CDP")
//{
//attachment.FileName="Customer Down Payment "+ci.ID.content+".pdf";
//}
//else if(ci.ProcessingTypeCode == "CI")
//{
//attachment.FileName="Customer Invoice "+ci.ID.content+".pdf";
//}
//
////To simulate Preview
//var docOutReq : elementsof DocumentOutputRequest;
//
//docOutReq.ReferenceObjectNodeID.content = ins_this.CustomerInvoiceUUID.content.ToString(); // UUID of root node.
//docOutReq.ReferenceObjectNodeTypeCode.content = "229"; //Object Node Type code of Quote root node
//docOutReq.ReferenceObjectTypeCode.content = "28"; //Object type code of Quote BO
//
//var docInst = DocumentOutputRequest.Create(docOutReq);
//
//var FTG : OutputRequestFormTemplateGroupCode;
//FTG.content = "C41"; //Form Template Group Code for Quote
//
//docInst.RefreshDefaultOutputRequest(FTG);
//
//var DocItem = docInst.Item;
//var docItem = docInst.Item.GetFirst(); // Or get based on lang, template code.
//
//docItem.Preview(); // Execute preview action
//var binCont = docItem.ItemPreview.PreviewBinaryObject; // Get the binary object of PDF.
//
//attachment.Binary=docItem.ItemPreview.PreviewBinaryObject.content;
//
//docInst.Delete();
//
//attachments.Add(attachment);
//
//}
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.