Generates the source code of the email message to be sent from the variables in the
Email structure or in a variable of type
Email.
The source code is generated in the
Email.Source variable or in the
Source property of the
Email variable. Then, this source code can be saved in a .eml file for example.
Remark: This function is useful to modify an element found in an outgoing email. The email can be sent by
EmailSend. For more details, see
Writing a custom email.
Example with an Email variable
// Initialize the variable
MyMessage is Email
Add(MyMessage.Recipient, "support_test@pcsoft_testfr")
MyMessage.Sender = "customer@company.fr"
MyMessage.Message = "Auto Email Test"
// Create the .eml file
IF EmailBuildSource(MyMessage) = True THEN
fSaveText("c:\MyEmails\Test.eml", MyMessage.Source)
END
Example with the Email structure
// Initialize the email structure
Email.NbRecipient = 1
Email.Recipient = "support_test@pcsoft_test.fr"
Email.Sender = "customer@company.fr"
Email.Message = "Auto Email Test"
// Create the .eml file
IF EmailBuildSource() = True THEN
fSaveText("c:\MyEmails\Test.eml", Email.Source)
END
Syntax
<Result> = EmailBuildSource([<Email> [, <Advanced options>]])
<Result>: Boolean
- True if the source code was generated,
- False otherwise. If an error occurs, the ErrorOccurred variable is set to True.
To get more details on the error, use ErrorInfo with the errMessage constant. The generated code can be read in the Email.Source variable of current thread.
<Email>: Optional Email variable
Name of the Email variable to be used.
If this parameter is not specified, the Email structure is used.
<Advanced options>: Optional Integer constant
Combination of following constants: | |
emailOptionEncodeHeader | Encodes the message headers in Quoted-Printable if necessary. The message header is not encoded by default. This constant prevents the emails with wrongly encoded accented characters. |
emailOptionHeaderBcc | Used to add the non-official recipients into the source code of email header. |