Private Sub cmdQuit_Click()
Unload Me
End Sub
Private Sub cmdSend_Click()
On Error GoTo errhand
Dim objConfig As CDO.Configuration
Dim objMessage As CDO.Message
Set objConfig = New CDO.Configuration
' Set the configuration fields for this message.
With objConfig.Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = txtServer ' Set the SMTP server
.Item(cdoSMTPConnectionTimeout) = 30
.Item(cdoSMTPServerPort) = txtPort ' Set the port to communicate on
.Item(cdoSendUserName) = "user1"
.Item(cdoSendPassword) = "user1"
.Update
End With
' Create the new message object.
Set objMessage = New CDO.Message
' Set the message properties and send the message.
With objMessage
Set .Configuration = objConfig
.MimeFormatted = True
.Fields.Update
.To = "<" & txtTo & ">"
.From = "<" & txtFrom & ">"
.Subject = txtSubject
.TextBody = txtBody<BR/>
' Set the Character set for the Body Part.
.TextBodyPart.Charset = cdoShift_JIS
' Get the plain text version of the message & decoded body part.
Set IBodyPart = objMessage.TextBodyPart
IBodyPart.GetDecodedContentStream
.Send
End With
Set objMessage = Nothing
Set mobjConfig = Nothing
Exit Sub
errhand:
MsgBox "Error: " & Err.Number & " (" & Err.Description & ") occurred"
Set objMessage = Nothing
Set objConfig = Nothing
End Sub