Hi,
This example show how easy it is to send an email using smtp in this case via the We Only Do smtp component. Also, attached is the rewrite of my VB6.0 - Office Outlook mail retrieval program.
vb Code:
Dim WithEvents smtp As wodSmtpCom
Private Sub Form_Load()
Set smtp = New wodSmtpCom
smtp.HostName = "smtp.gmail.com"
smtp.Security = SecurityImplicit
smtp.Login = "your email"
smtp.Password = "your password"
smtp.Authentication = AuthLogin
smtp.Blocking = True
On Error Resume Next
smtp.Connect
smtp.Message.Attach "Attachment"
smtp.Message.Attach "Attachment"
smtp.Message.From = "your email"
smtp.Message.To = "to email"
smtp.Message.Subject = "test"
smtp.Message.Text = "testing"
smtp.SendMessage
smtp.Disconnect
End Sub
Private Sub smtp_Disconnected(ByVal ErrorCode As Long, ByVal ErrorText As String)
Debug.Print "Disconnected: " & ErrorText
If ErrorCode <> 0 Then
Debug.Print smtp.Transcript
End If
End Sub
Private Sub smtp_Done(ByVal ErrorCode As Long, ByVal ErrorText As String)
If ErrorCode <> 0 Then
Debug.Print "Done Event: " & ErrorText
Else
Debug.Print "E-mail sent!"
End If
End Sub
Edit:
The attachment contains both the code for smtp and pop functionality.
Other samples are available from the WeOnlyDo site.
Note: You need to download the Smtp component in order to use the example.
Nightwalker