SendMail()

Syntax

Result = SendMail(#Mail, Smtp$ [, Port [, Asynchronous [, User$, Password$]]])
Description
Send the specified mail.

Parameters

#Mail The mail to send.
Smtp$ The address of the mail server to use for sending the mail.
Port (optional) The port of the mail server. The default is port 25.
Asynchronous (optional) Whether the transfer should be done in the background. If this parameter is nonzero then the function returns immediately and the progress can be checked with the MailProgress() function. If this parameter is zero or not specified, then the function blocks until the mail was sent or there was an error.
User$, Password$ (optional) The user and password used for SMTP authentication, if the server requires it.

Return value

Returns nonzero if the mail was sent correctly and zero otherwise.

Example

  InitNetwork()

  ; Note: change the address and smtp to have a working example
  ;
  If CreateMail(0, "test@youraddress.com", "Hello")
    AddMailRecipient(0, "youraddress@youraddress.com", #PB_Mail_To)

    Debug SendMail(0, "smtp.yourfavoritesmtp.com")
  EndIf

See Also

CreateMail(), MailProgress()

Supported OS

All

<- RemoveMailRecipient() - Mail Index - SetMailAttribute() ->