I use the following code to send e-mail using cdo:
Public Function SendMail()
Dim cdoConfig
Dim msgOne
On Error GoTo Err_Handler:
Set cdoConfig = CreateObject("CDO.Configuration")
Set cdoMessage = CreateObject("CDO.Message")
Set cdoMessage.Configuration = cdoConfig
With cdoConfig.Fields
.Item(cdoSendUsingMethod) = pubCdoSendUsing
.Item(cdoSMTPServerPort) = pubCdoSMTPServerPort
.Item(cdoSMTPServer) = pubCdoSMTPServer
.Item(cdoSMTPAuthenticate) = pubCdoAuthentication
If pubCdoAuthentication <> 1 Then
.Item(cdoSendUserName) = pubCdoSendUserName
.Item(cdoSendPassword) = pubCdoSendPassword
End If
.Item(cdoSMTPConnectionTimeOut) = pubCdoSMTPConnectionTimeOut
.Item(cdoSMTPUseSSL) = pubCdoSMTPUseSSL
.Update
End With
With cdoMessage
Set .Configuration = cdoConfig
.To = pubCdoMessageRecipientsTo
.BCC = pubCdoMessageRecipientsBcc
.From = pubCdoMessageFrom
.Subject = pubCdoMessageSubject
.TextBody = pubCdoMessageBody
.Send
End With
Err_Handler:
Select Case Err.Number
Case 0
MsgBox "Message Sent", vbInformation, "Message Sent"
Case Else
MsgBox "Error No.: " & Err.Number & vbNewLine & vbNewLine & _
"Description: " & Err.Description, vbCritical, "Error: " & Err.Number
End Select
End Function
How do I change the priority of the e-mail?
Public Function SendMail()
Dim cdoConfig
Dim msgOne
On Error GoTo Err_Handler:
Set cdoConfig = CreateObject("CDO.Configuration")
Set cdoMessage = CreateObject("CDO.Message")
Set cdoMessage.Configuration = cdoConfig
With cdoConfig.Fields
.Item(cdoSendUsingMethod) = pubCdoSendUsing
.Item(cdoSMTPServerPort) = pubCdoSMTPServerPort
.Item(cdoSMTPServer) = pubCdoSMTPServer
.Item(cdoSMTPAuthenticate) = pubCdoAuthentication
If pubCdoAuthentication <> 1 Then
.Item(cdoSendUserName) = pubCdoSendUserName
.Item(cdoSendPassword) = pubCdoSendPassword
End If
.Item(cdoSMTPConnectionTimeOut) = pubCdoSMTPConnectionTimeOut
.Item(cdoSMTPUseSSL) = pubCdoSMTPUseSSL
.Update
End With
With cdoMessage
Set .Configuration = cdoConfig
.To = pubCdoMessageRecipientsTo
.BCC = pubCdoMessageRecipientsBcc
.From = pubCdoMessageFrom
.Subject = pubCdoMessageSubject
.TextBody = pubCdoMessageBody
.Send
End With
Err_Handler:
Select Case Err.Number
Case 0
MsgBox "Message Sent", vbInformation, "Message Sent"
Case Else
MsgBox "Error No.: " & Err.Number & vbNewLine & vbNewLine & _
"Description: " & Err.Description, vbCritical, "Error: " & Err.Number
End Select
End Function
How do I change the priority of the e-mail?