Solved

CDO Email and Importance field

Posted on 2003-10-24
9
2,345 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
 
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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 information …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

747 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

13 Experts available now in Live!

Get 1:1 Help Now