Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

How to add multiple attachment in smtp mail

Posted on by Microsoft Employee

Hi Experts,

i want to attach multiple file(multiple reports) in smtp mail please tell me any solution,

this my code

PdfDocPath :='ABC.pdf';

PdfDocPath1 := 'Customer ledger Report.pdf';

Path := 'C:\\Temp'+PdfDocPath+PdfDocPath1  // Directory + Path

CLEAR(ABC);// ABC is a Report 50088

CLEAR(Customer ledger Report)

ABC.USEREQUESTPAGE(FALSE); //// for filteration

Customer ledger Report.USEREQUESTPAGE(FALSE); //// for filteration

IF NOT ABC.SAVEASPDF(Path) THEN

IF NOT Customer ledger Report.SAVEASPDF(Path) THEN

ERROR('PDF Creating Failed!\\ERROR:\\' + GETLASTERRORTEXT);

SMTP.CreateMessage('Jonas Wood','arunkumar.A@gmail .com','','outstanding amount');

SMTP.AppendBody('Dear Sir / Madam,');

SMTP.AppendBody('<br><br>');

SMTP.AppendBody('Please find the Customer Ledger report in PDF Format:');

SMTP.AppendBody('<br><br>');

SMTP.AppendBody('Regards');

SMTP.AppendBody('<br>');

SMTP.AppendBody('Company Accounts Departments ');

SMTP.AddAttachment(Path,PdfDocPath,PdfDocPath1 );

SMTP.Send;

//ERASE(Path);

Thank you

*This post is locked for comments

  • manish.yadav Profile Picture
    manish.yadav 1,835 on at
    RE: How to add multiple attachment in smtp mail

    Dear Arun Ji,

    You can get idea from my posted thread.

    community.dynamics.com/.../658673

    Hope it will help you.

  • Suggested answer
    Stefano Demiliani Profile Picture
    Stefano Demiliani 37,162 Most Valuable Professional on at
    RE: How to add multiple attachment in smtp mail

    Just call SMTP.AddAttachment for every file you want to attach to your message.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans