Solved

CDO Email and Importance field

Posted on 2003-10-24
9
2,368 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
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…

896 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

14 Experts available now in Live!

Get 1:1 Help Now