Here is a working example.  It is even configured for use with AOL.

HTH


  Dim mail as EmailMessage
  Dim file as EmailAttachment
  Dim i as Integer
  Dim s as String
  
  SMTPSocket1.address = "smtp.aol.com"
  SMTPSocket1.port = 587
  
  SMTPSocket1.username = usernameFld.text  //get username from EditField
  SMTPSocket1.password = passwordFld.text  //get password from EditField
  
  mail = New EmailMessage
  mail.fromAddress=fromAddressFld.text  //get From address from EditField
  mail.subject=subjectFld.text  //get Subject of mail from EditField
  mail.bodyPlainText = fromAddressFld.Text + EndOfLine + toAddressFld.Text +
EndOfLine + subjectFld.Text _
      + EndOfLine + EndOfLine + bodyFld.text   //get body in plain text from
EditField
  mail.headers.appendHeader "X-Mailer","REALbasic SMTP Demo"
  
  //multiple To addresses separated by commas
  //each to address added to Recipient array
  s = ReplaceAll(toAddressFld.text,",",Chr(13))
  For i = 1 to CountFields(s,Chr(13))
    mail.addRecipient Trim(NthField(s,Chr(13),i))
  next
  
  //multiple CC addresses separated by commas
  //each to address added to CCRecipient array
  
  s = ReplaceAll(ccAddressFld.text,",",Chr(13))
  For i = 1 to CountFields(s,Chr(13))
    mail.addCCRecipient Trim(NthField(s,Chr(13),i))
  next
  
  SMTPSocket1.messages.append mail //add email to list of messages
  SMTPSocket1.SendMail //send message
  


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to