?
Solved

CDO Email and Importance field

Posted on 2003-10-24
9
Medium Priority
?
2,462 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 240 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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 informatio…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

762 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