Add reference : Microsoft CDO For Windows 2000 Library
5 textboxes, 1 button
Try This :
Private Sub Command1_Click()
On Error GoTo ErrHandler
Dim oConfig As New CDO.Configuration
Dim oMsg As New CDO.Message
Label1.Caption = ""
With oConfig.Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServerPort) = 465
.Item(cdoSMTPServer) = "smtp.mail.yahoo.com"
.Item(cdoSMTPAuthenticate) = cdoBasic
.Item(cdoSendUserName) = txtSender.Text
.Item(cdoSendPassword) = txtPassword.Text
.Item(cdoSendEmailAddress) = txtSender.Text
.Item(cdoSMTPUseSSL) = 1
.Update
End With
With oMsg
.Configuration = oConfig
.Subject = txtSubject.Text
.To = txtAddress.Text
.From = txtSender.Text
.HTMLBody = txtMessage.Text
.Send
End With
Set oMsg = Nothing
Set oConfig = Nothing
Label1.Caption = "Email Sent"
Exit Sub
ErrHandler:
MsgBox Err.Description, vbCritical, "Error"
End Sub