CDO + Set Priority Level

TimTDP

Registered User.
Local time
Today, 22:02
Joined
Oct 24, 2008
Messages
213
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?
 
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?



Try:

Code:
.Item(cdoImportance) = cdoHigh
 

Users who are viewing this thread

Back
Top Bottom