First thing is to check that SMTP server is setup correctly in form 409 (SMTP Mail Setup).
Then using codeunit 400 (SMTP Mail), the basic syntax goes something like this:
SMTP.CreateMessage (‘My Name’,'fromemailaddress@somedomain.com','tosomeone@thierdomain.com',’Subject’,’Body’,TRUE); <-- This creates the message and allows a simple subject to be specified (subject) and a short body message (1024 characters if you modify the string lengths).
however, I use this for the body text:
SMTP.AppendBody('your text here'); <-- You can repeat this as many times as needed.
And lastly to send the email:
SMTP.Send;
Now, as this can use HTML format for the email (The "TRUE" bit of the SMTP.CreateMessage) you can format the email with HTML tags, so on our system I created a number of Text Constants (as below):
Comments
Thanks for reply
yes i have with the code like this on mail button
Recipients := 'punit.sharma@abc.com,subedar.ali@abc.com';
Mail.MailContCustVendBank(DATABASE::Customer,'BRSC00019',Recipients);
This is working fine, but here how can i manage my other values in mail body.
I want to use this code
SenderName := 'subedar.ali@abc.com';
SenderAddress := 'brijendra.singh@abc.com';
Recipients := 'punit.sharma@abc.com';
Subject := 'Please see the mail its imp';
In Body
'Total Employe :20
revenue :4000
SMTPMail.CreateMessage(SenderName,SenderAddress,Recipients,Subject,Body,HtmlFormatted);
i want to use this code ,even i am not getting any error but still i am anable to send mail
Plz help
Then using codeunit 400 (SMTP Mail), the basic syntax goes something like this: however, I use this for the body text: And lastly to send the email: Now, as this can use HTML format for the email (The "TRUE" bit of the SMTP.CreateMessage) you can format the email with HTML tags, so on our system I created a number of Text Constants (as below):
If you have a look at codeunit 400 you will see most of this and more functions for you to use
Dean.