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

Posted on 2006-05-05
Last Modified: 2008-02-01
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("") = 2
'            .Item("") = <"mymailserver">
            .Item("") = SMTPServerAddress
            .Item("") = 25
            ' for Outlook: <BR> 
            '.Item(cdoImportance) = cdoHigh
            '.Item(cdoPriority) = cdoPriorityUrgent
            ' for Outlook Express:
            .Item("urn:schemas:mailheader:X-Priority") = 2
   End With

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

Question by:soninfor
    LVL 19

    Expert Comment

    I dont think cdoHigh is known in asp.

    Use numeric values:
    0 - Low
    1 - Normal
    2 - High
    LVL 19

    Expert Comment

    btw, for cdoPriorityUrgent

    -1 cdoPriorityNonUrgent
    0 cdoPriorityNormal
    1 cdoPriorityUrgent

    Author Comment

    still does not work

    LVL 19

    Accepted Solution

    Try this code.

        Set cdoConfig = CreateObject("CDO.Configuration")  
        Set cdoMessage = CreateObject("CDO.Message")  
        cdoConfig.Fields.Item(cdoSendUsingMethod) = cdoSendUsingPort  
        cdoConfig.Fields.Item(cdoSMTPServer) = ""  
        With cdoMessage.Fields
            ' for Outlook:
            .Item(cdoImportance) = cdoHigh  
            .Item(cdoPriority) = cdoPriorityUrgent  
            ' for Outlook Express:
            .Item("urn:schemas:mailheader:X-Priority") = 1
        End With
        With cdoMessage  
            Set .Configuration = cdoConfig  
            .From = ""  
            .To = ""  
            .Subject = "Sample CDO Message"  
            .TextBody = "This is a test for CDO.message"  
        End With  
        Set cdoMessage = Nothing  
        Set cdoConfig = Nothing  

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Adobe Photoshop CC 2015

    Photoshop has become the standard in image manipulation among professional photographers and graphic designers. This course covers exam objectives for the Adobe Certified Associate (ACA) certification.

    Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
    Both Easy and Powerful How easy is PHP? (  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
    Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
    The viewer will learn how to dynamically set the form action using jQuery.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now