CreateMail()

Syntax

Result = CreateMail(#Mail, From$, Subject$ [, Encoding])
Description
Create a new, empty #Mail. If #PB_Any is used as '#Mail' parameter, the new mail number will be returned as 'Result'. 'From$' will be the reply address to this mail. 'Subject$' will be the short text which is displayed to quickly resume the mail content. 'Encoding' is an optional parameter and can be one of the following value:
  PB_Ascii : The mail body will be in ascii (default)
  PB_UTF8  : The mail body will be in UTF-8
If the mail can not be correctly created, 'Result' will be 0.

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.

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

Supported OS

All

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