Result = CreateMail(#Mail, From$, Subject$ [, Encoding])
Create a new, empty mail.


#Mail A number to identify the new mail. #PB_Any can be used to auto-generate this number.
From$ The sender address for the mail. The address have to be one of the following format:
  "Joe Doe <>"
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 
  #PB_UTF8  : The mail body will be in UTF-8 (default)

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.


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).



  If CreateMail(0, "", "Hello")
    SetMailBody(0, "This is a body !" + #CRLF$ + "Second line")
    Debug "Mail created"
    Debug "Can't create the mail"

See Also

InitNetwork(), SetMailBody(), SetMailAttribute(), AddMailAttachment(), AddMailAttachmentData(), SendMail(), FreeMail()

Supported OS


<- AddMailRecipient() - Mail Index - FreeMail() ->