All About SENDMAIL function:
Below is what is specified in PeopleBooks on SENDMAIL function. After the end of the transcript on SENDMAIL function I have mentioned my learning and findings of using this function.
SendMail(flags, recipients, CCs, BCCs, subject, text,[, attachment_filenames][, attachment_titles] [,Mail_From] [,mail_sep] [, Content_Type] [,Reply_To] [,Sender])
Use the SendMail function to send an email message from a PeopleSoft page. The APIs that support these subsystems must be present on the system for the function to work.
Note. The code that actually calls SendMail determines the run location, not the originating code.
The function sends a message using standard mail options, including recipient, CC, BCC, subject, and the text of the note. The message can include attached files, for which you supply fully qualified file names (that is, file names with paths) and titles (which appear in place of the fully qualified filename in the message). In addition, you can specify a Mail_From , which identifies the source email address. You can also use the Reply_To parameter to specify the email address to be used by the recipient for replying, which should be different than the Mail_From address.
The flags parameter of this function and its return codes are platform dependent: the SMTP mail API ignores any additional flags. For this reason, SendMail should be used only in customizations that run on a known platform, if it is used at all. The preferred, platform-independent method for sending email from PeopleCode is to define an email routing as part of a business event, then trigger the business event using the TriggerBusinessEvent function.
For workflow, in the activity email routing, you can specify the field map for Reply_To and Sender.
An integer value passed directly to the mail system API to control mail system options. The value passed in this parameter is platform-dependent. The SMTP mail API ignores this parameter.
A string consisting of a semicolon-separated list of email addresses containing the names of the message’s primary recipients.
A string consisting of a semicolon-separated list of email addresses that are sent copies of the message.
A string consisting of a semicolon-separated list of email addresses that are sent copies of the message. These recipients won’t appear on the message list.
A string containing the text that appears in the message’s Subject field.
The text of the message.
A string consisting of a semicolon-separated list of fully qualified filenames, containing the complete path to the file and the filename itself.
Another semicolon-separated list containing titles for each of the files provided in the attachment_filenames parameter. The titles appear near the attachment icons in place of the fully qualified filename.
A string used to populate the 'reply-to' field. If this parameter isn't specified, the sender address from application server configuration file is used.
My Observation: This email id need not be a valid email address and this can also be a string field.
Specify the delimiter to be used to separate one email address from another. The default value is a semicolon (;).
Specify the content type of the email as a string. The default value is plain text.
If you want to specify HTML, you should use the following:
Content-type: text/html; charset=utf8
Specify the email address that the receiver should use when replying to this email instead of the Mail_From value.
Specifies who the email is from, as a string. This may be different than the values specified for Mail_From or Reply_To parameters.
Returns a Number value, which, if not one of the following general return codes, is platform-dependent.
Return Code 0 signifies 'No Error' while -1 denotes 'No mail interface installed'.
The following example sets up several variables that are then used to construct an email message that includes two attachments:
&MAIL_FLAGS = 0;
&MAIL_TO = "email@example.com;firstname.lastname@example.org";
&MAIL_CC = "";
&MAIL_BCC = "email@example.com";
&MAIL_SUBJECT = "Live long and prosper!";
&MAIL_TEXT = "Please read my attached CV. You will be amazed and hire me forthwith.";
&MAIL_FILES = "c:\mydocs\resume.doc;c:\mydocs\coverlet.doc";
&MAIL_TITLES = "My CV;READ ME";
&MAIL_SENDER = "MyEmail@Yahoo.com";
&RET = SendMail(&MAIL_FLAGS, &MAIL_TO, &MAIL_CC, &MAIL_BCC, &MAIL_SUBJECT, &MAIL_TEXT, &MAIL_FILES, &MAIL_TITLES, &MAIL_SENDER);
if not (&RET = 0) then
WinMessage("Return status from mail = " &RET);
I used the below syntax to send an email function:
SendMail(&MAIL_FLAGS, &emp_emailid, &MAIL_CC, &MAIL_BCC, &MAIL_SUBJECT, &MAIL_TEXT, &MAIL_FILES, &MAIL_TITLES, &MAIL_SENDER, "Content-type: text/html;");
Below is the email that got sent with html tags- html, pr, br...
All the tags as posted in the Message Catalog gets sent in the same way as text instead of resolving the html tags. Pasting html tags automatically gets resolved in blogger and I am not having the patience to debug it. The essence is html tabs do not get resolved properly if Content type is not defined properly.
The email I got(html tags gets resolved in blogger):
Please do not reply to this automatic notification. Contents in paragraph header Uniqueid.
I actually wanted a HTML format email and hence had used html tags in message catalog used to send this email. I spotted a minor difference which did not send the email in HTML format and instead caused to send the email with html tags as text.
SendMail(&MAIL_FLAGS, &emp_emailid, &MAIL_CC, &MAIL_BCC, &MAIL_SUBJECT, &MAIL_TEXT, &MAIL_FILES, &MAIL_TITLES, &MAIL_SENDER, ";", "Content-type: text/html;");
Please do not reply to this automatic notification.
Contents in paragraph header Uniqueid. Contents inside the paragraph.
Final email contents.