CDO.Message - how do i set the importance/priority of the email with CDO.message in ASP?

Hi ,

I tried the following but it didn't work.

                Set objCDOMail = CreateObject("CDO.Message")
      Set objConfig = CreateObject("CDO.configuration")
      Set objFields = objConfig.Fields

                With objFields
            .Item("http://schemas.microsoft.com/cdo/configuration/SendUsing") = 2
'            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = <"mymailserver">
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServerAddress
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverPort") = 25
            ' for Outlook: <BR> 
            '.Item(cdoImportance) = cdoHigh
            '.Item(cdoPriority) = cdoPriorityUrgent
            ' for Outlook Express:
            .Item("urn:schemas:mailheader:X-Priority") = 2
            .Update
   End With

my mail client is MS Outlook; it doesn't sem to be working.

soninforAsked:
Who is Participating?
 
MsShadowConnect With a Mentor Commented:
Try this code.

<%  
    Set cdoConfig = CreateObject("CDO.Configuration")  
    Set cdoMessage = CreateObject("CDO.Message")  
     
    cdoConfig.Fields.Item(cdoSendUsingMethod) = cdoSendUsingPort  
    cdoConfig.Fields.Item(cdoSMTPServer) = "mail.server.name"  
    cdoConfig.Fields.Update  
 
    With cdoMessage.Fields
 
        ' for Outlook:
        .Item(cdoImportance) = cdoHigh  
        .Item(cdoPriority) = cdoPriorityUrgent  
 
        ' for Outlook Express:
        .Item("urn:schemas:mailheader:X-Priority") = 1
 
        .Update
    End With
 
    With cdoMessage  
        Set .Configuration = cdoConfig  
        .From = "from@from.com"  
        .To = "to@to.com"  
        .Subject = "Sample CDO Message"  
        .TextBody = "This is a test for CDO.message"  
        .Send  
    End With  
 
    Set cdoMessage = Nothing  
    Set cdoConfig = Nothing  
%>
0
 
MsShadowCommented:
I dont think cdoHigh is known in asp.

Use numeric values:
0 - Low
1 - Normal
2 - High
0
 
MsShadowCommented:
btw, for cdoPriorityUrgent

->
-1 cdoPriorityNonUrgent
0 cdoPriorityNormal
1 cdoPriorityUrgent
0
 
soninforAuthor Commented:
still does not work

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.