Sending Email

Jump to Run BASIC Help File

Getting an SMTP Sender
SMTPSender methods

Run BASIC includes an object for sending email using an external SMTP server.

Getting an SMTP Sender

Use the SMTPSENDER statement to get an SMTP sender object.  Specify an object variable and also the domain of the mail server.  For example:

  smtpsender #aSender, "mail.myserver.com"

Then set more parameters by calling methods on the object.  For example:

  smtpsender #aSender, "mail.myserver.com"
  #aSender password("myPassword")
  senderAddr$ = "Joe the Plumber<joetp@myserver.com>"
  receiverAddr$ = "some-guy@gmail.com"
  #aSender send(fromAddr$, toAddr$, _
    "Fixing leaky pipes", _
    "I'll be over after lunch Mr. McCain!")

If you do not have a full name for the from address the SMTP sender will use the email address for the full name.  For example:

  fromAddr$ = "joetp@myserver.com"
 

SMTPSENDER methods

#handle SEND(senderAddr$, receiverAddr$, subject$, message$) - Send a message using the senderAddr$ and receiverAddr$, and specifying the subject$ and message$.
#handle PASSWORD(password$) - Provide the password the SMTP server will expect for the sender's address.
#handle ISNULL() - Returns zero (or false)
#handle DEBUG$() - Returns the string "SMTPSender"