BCC using SMTPMail

Red-EagleRed-Eagle Member Posts: 107
I have a form with has the following code:

TESTFIELD("Buy-from Vendor No.");
Vendor.GET("Buy-from Vendor No.");

IF Vendor."E-Mail for Purch. Order" = '' THEN
CurrReport.SKIP;

EMailOnBehalf.SETRANGE(Usage, EMailOnBehalf.Usage::"Purchase Order");

IF EMailOnBehalf.FINDFIRST THEN BEGIN
EMailOnBehalf.TESTFIELD("Send On Behalf Of E-mail");
SMTPMail.CreateMessage(
EMailOnBehalf."Send On Behalf Of Name",
EMailOnBehalf."Send On Behalf Of E-mail",
Vendor."E-Mail for Purch. Order",
STRSUBSTNO(Text000, "No."),
'',
FALSE);
END ELSE
SMTPMail.CreateMessage(
CompanyInfo.Name,
CompanyInfo."E-Mail",
Vendor."E-Mail for Purch. Order",
STRSUBSTNO(Text000, "No."),
'',
FALSE);



EMailBodyText.SETRANGE(Usage, EMailBodyText.Usage::"Purchase Order");
EMailBodyText.SETRANGE("Language Code", "Language Code");

IF EMailBodyText.ISEMPTY THEN
EMailBodyText.SETRANGE("Language Code", '');

IF EMailBodyText.FINDSET THEN BEGIN
REPEAT
SMTPMail.AppendBody(STRSUBSTNO(EMailBodyText.Text + CrLf, CompanyInfo.Name))
UNTIL EMailBodyText.NEXT = 0;
END;

PurchaseHeader.COPY("Purchase Header");

CASE UseDefaultReportSelection OF
TRUE: GetDefaultReportSelection(TempReportSelections.Usage::"P.Order", TempReportSelections);
FALSE: DocPrint.GetReportSelection(TempReportSelections.Usage::"P.Order", TempReportSelections, TRUE);
END;

IF TempReportSelections.FINDFIRST THEN
REPEAT
TempFileName := STRSUBSTNO('%1.%2', "No.", TempReportSelections.Sequence);
SaveReportAsPDF.PurchaseHeader(PurchaseHeader, TempReportSelections."Report ID", TempFolderName, TempFileName, 30000);
SMTPMail.AddAttachment(STRSUBSTNO('%1\%2.pdf', TempFolderName, TempFileName));
UNTIL TempReportSelections.NEXT = 0;

DocumentRelation.SETRANGE("Document Type", DocumentRelation."Document Type"::"Purchase Order");
DocumentRelation.SETRANGE("No.", "Purchase Header"."No.");

IF DocumentRelation.FINDSET THEN
REPEAT
IF Document.GET(DocumentRelation."Related Document No.") THEN
IF Document.FullFileName <> '' THEN
IF FILE.EXISTS(Document.FullFileName) THEN
SMTPMail.AddAttachment(Document.FullFileName)
UNTIL DocumentRelation.NEXT = 0;

SMTPMail.Send;



Now I want to change this that it will also send a e-mail using BCC, so we can see what we have send and when.

Answers

  • rsfairbanksrsfairbanks Member Posts: 107
    SMTPMail.AddBCC(emailaddress)

    You can pick up emailadress from Salesperson code
  • krikikriki Member, Moderator Posts: 9,110
    [Topic moved from 'NAV 2009' forum to 'NAV/Navision' forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.