FathMail component guide

FathMail features:

  •  send message using SMTP with optional authentication

  •  add attachments (files, images, etc.)

  •  enumerate/retrieve/delete messages from POP3 servers

  •  ability to retrieve only header of a message for faster processing

  •  store messages into archive and create messages out of raw MIME text

  •  receive/enumerate/save attachments from received messages

  •  

    Here is sample code in Visual Basic showing basic functions of FathMail object.

    For more info on FathMail objects, properties and methods, see FathMail reference.

     

    Compose a new message

    Dim oMsg as FathMail.Message

    Set oMsg= New FathMail.Message

    oMsg.Sender = "myaddress@domain.com"

    oMsg.Recipient = "hisaddress@domain.com"

    oMsg.Subject = "test message"

    oMsg.Text = "Hi, this is a message."

    oMsg.TextHTML = "Hi, <p> this is a HTML message."

    oMsg.AddAttachment "mypicture.jpg"

     

    Send message using SMTP

    Dim oSMTP as FathMail.SMTP

    Set oSMTP = New FathMail.SMTP

    oSMTP.ServerAddr = "mail.domain.com"

    oSMTP.Send oMsg

     

    mail server address can be retrieved through DNS MX record with SMTP GetMX method:

    oSMTP.ServerAddr = oSMTP.GetMX ( "hisaddress@domain.com" )

     

     

    Receive message using POP3

    Dim oPOP3 as FathMail.POP3

    Set oPOP3 = New FathMail.POP3

    oPOP3.ServerAddr = "mail.domain.com"

    oPOP3.Username = "scott"

    oPOP3.Password = "tiger"

    oPOP3.Connect

    if oPOP3.GetMessageCount Then

        oMsg = oPOP3.Retrieve(1) 'retrieve first message and store it in Message object

    End If

    oPOP3.Disconnect

     

    Archive message

    Massage data can be stored in text variable with GetRaw method of Message object. And displayed later using SetRaw method.

    Dim sMsg as String

    sMsg = oMsg.GetRaw

    now you can store sMsg in database or text file.

    If you want to display a stored message from archive, just read this string from a database and create Message object using SetRaw method.

    sMsg=ReadDatabase()

    oMsg.SetRaw sMsg

    oSMTP.Send oMsg

     Fath Software on the Web: www.fathsoft.com

    e-mail support: support@fathsoft.com