[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2131
  • Last Modified:

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.

0
soninfor
Asked:
soninfor
  • 3
1 Solution
 
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
 
MsShadowCommented:
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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now