[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

CDO Email and Importance field

Posted on 2003-10-24
9
Medium Priority
?
2,506 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

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…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

649 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