CreateMail()
Syntax
Result = CreateMail(#Mail, From$, Subject$ [, Encoding])Description
Create a new, empty mail.
Parameters
A number to identify the new mail. #PB_Any can be used to auto-generate this number. From$ The sender address for the mail. Subject$ The subject line for the mail. Encoding (optional) The encoding for the mail. It can be one of the following values: #PB_Ascii : The mail body will be in ascii (default) #PB_UTF8 : The mail body will be in UTF-8
Return value
Returns nonzero if the mail was created successfully and zero if not. If #PB_Any was used as the #Mail parameter, then the auto-generated number is returned in case of success.
Remarks
SetMailBody(), SetMailAttribute(), AddMailAttachment() and AddMailAttachmentData() can be used to change the content of the #Mail.
Note: According to the RFC 2822 standard a line break in an e-mail need to be done always using the CRLF chars.
On Linux, 'libcurl' needs to be installed to have the mail commands working (most of Linux distributions comes with it already installed).
Example
InitNetwork() If CreateMail(0, "test@purebasic.com", "Hello") SetMailBody(0, "This is a body !" + #CRLF$ + "Second line") Debug "Mail created" Else Debug "Can't create the mail" EndIf
See Also
InitNetwork(), SetMailBody(), SetMailAttribute(), AddMailAttachment(), AddMailAttachmentData(), SendMail(), FreeMail()
Supported OS
All