Solved

CDO Email and Importance field

Posted on 2003-10-24
9
2,391 Views
Last Modified: 2012-05-04
Hi All,

I'm using the CDO object to support email in my Web Application. The below is the sample code. This code works fine for me.  I wanted to know how do I set the Importance field (e.g. Low, Normal or High) for my email message.

Thanks in advance.
Lilu

-------------------------------------------------------------------------------------------
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields

Flds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserver") =  "RemoteSMTPSrvName"
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
Flds("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
Flds(http://schemas.microsoft.com/cdo/configuration/smtpauthenticate)     = 0 Flds.Update

With iMsg
      Set .Configuration = iConf
     .To          = "myemailid@company.com"
     .From        = "myemailid@company.com"
     .Subject     = "email subject"
     .TextBody    = "Email body"
    .Send
End With

Set iMsg = Nothing
Set iConf = Nothing
----------------------------------------------------------------------------------------------
0
Comment
Question by:lilupat
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 9617424
.Importance = 0 ' or 1 or 2 - low, medium, high
0
 
LVL 3

Expert Comment

by:keystrokes
ID: 9617429
const CdoLow = 0 ' Low importance  
const CdoNormal = 1  'Normal importance (default)  
const CdoHigh = 2  'High importance  

iMsg.Importance = CdoHigh
0
 

Author Comment

by:lilupat
ID: 9617895
Hi,

IMessage interface does not support "Importance" property. I get  an error "Object doesn't support this property or method: 'Importance'" . I have attached the code here again.

Thanks,
Lilu

-------------------------------------------------------------------------------------------
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields

Flds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserver") =  "RemoteSMTPSrvName"
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
Flds("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
Flds(http://schemas.microsoft.com/cdo/configuration/smtpauthenticate)     = 0 Flds.Update

With iMsg
      Set .Configuration = iConf
     .To          = "myemailid@company.com"
     .From        = "myemailid@company.com"
     .Subject     = "email subject"
     .TextBody    = "Email body"
     .Importance = 2     ' There is no Importance property
    .Send
End With

Set iMsg = Nothing
Set iConf = Nothing
----------------------------------------------------------------------------------------------
0
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.

 
LVL 58

Expert Comment

by:Gary
ID: 9617958
Try this in your Flds section
Flds("urn:schemas:httpmail:importance").Value = 1 ' 0,1,2 as before
0
 

Author Comment

by:lilupat
ID: 9618015
No this does work either. Although I don't get any error and email works fine. The importance flag did not set.

Also I checked at MSDN site, this schema  "urn:schemas:httpmail:importance" does not exist.

Also I tried with
Flds("http://schemas.microsoft.com/cdo/configuration/importance") = 2  

But that also didn't work.

Here I have attached the code again.

-------------------------------------------------------------------------------------------
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields

Flds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserver") =  "RemoteSMTPSrvName"
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
Flds("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
Flds(http://schemas.microsoft.com/cdo/configuration/smtpauthenticate)     = 0

========does not set the importance flag======================
'Flds("urn:schemas:httpmail:importance").value = 2 ' high importance
'Flds("http://schemas.microsoft.com/cdo/configuration/importance") = 2  =================================================

Flds.Update

With iMsg
      Set .Configuration = iConf
     .To          = "myemailid@company.com"
     .From        = "myemailid@company.com"
     .Subject     = "email subject"
     .TextBody    = "Email body"
     ' .Importance = 2     ' There is no Importance property
    .Send
End With

Set iMsg = Nothing
Set iConf = Nothing
---------------------------------------------------------------------------------------------

0
 
LVL 3

Expert Comment

by:evrcool
ID: 9620193
Try this.
    '0=low, 1=Normal, 2=High
    iMsg.Fields(CDO.cdoImportance) = 2
    iMsg.Fields.Update
0
 

Author Comment

by:lilupat
ID: 9620607
Hi ,

First of all how do I get the "CDO.cdoImportance" constant ? Do I need to include any file to get this constant ?

I tried like this   iMsg.Fields("CDO.cdoImportance") = 2  instead of
iMsg.Fields(CDO.cdoImportance) = 2. There is no error and email goes but does not set the importance flag.

There is an article in MSDN, it talks about how to set the importance field.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdo/html/_olemsg_importance_property_message.asp

But I did not understand what is that session objects. Can somebody help me understding this

Thanks in advance,
Lilupat





0
 
LVL 3

Accepted Solution

by:
evrcool earned 60 total points
ID: 9622595
Copy this code. Of couse, change out the SMTServer and the From and To, also make sure that the METADATA tag is all on one line when you copy it out of here.


<!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" NAME="CDO for Windows Library" -->
<%
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields

Flds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserver") =  "RemoteSMTPSrvName"
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
Flds("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
Flds("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0
Flds.Update

With iMsg
' Set the Importance
'0=low, 1=Normal, 2=High
            .Fields(cdoImportance) = 2
            .Fields.Update
' Set the Configuration
            Set .Configuration = iConf
' Set the normal fields
            .To          = "myemailid@company.com"
            .From        = "myemailid@company.com"
            .Subject     = "email subject"
            .TextBody    = "Email body"
' Send the email
    .Send
End With

Set iMsg = Nothing
Set iConf = Nothing

%>
0
 

Author Comment

by:lilupat
ID: 9624633
Thanks evrcool, It's working perfectly.

0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

856 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