?
Solved

how to set cdo message mail priority and Setting attachment Name

Posted on 2003-03-07
31
Medium Priority
?
2,500 Views
Last Modified: 2007-12-19
Hi All,

I am working on CDO Mailing system.

1. I doono how to set the priority of the mail.
2. I am setting up multiple attachments to the system. and I am able to send the mails with attachments. but it is taking default names for the attachment like "ATT10234" etc..

can anybody help me in this regard...


The following is the code that I am using ..


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

 
'''     Set the CDOSYS configuration fields to use port 25 on the SMTP server.

     
With Flds
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = MailServerIP
   .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpaccountname") = "TestAcc"
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = False
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
    .Update
End With    



'Apply the settings to the message.

With iMsg
    Set .Configuration = iConf
    .To = strTo
    .From = strFrom
    .CC = strCc
    .BCC = strBcc
    .Subject = strSubject
    .HTMLBody = strTextBody
for i=1 to ubound(arrAttachment)
    .AddAttachment arrAttachment(0,i),arrAttachment(1,i),3  

next
    .Send
End With

' Clean up variables.
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing


regards,
venkat
0
Comment
Question by:kven
[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
  • 17
  • 7
  • 5
  • +2
31 Comments
 
LVL 7

Expert Comment

by:markhoy
ID: 8089594
priority is just .priority =0 or 1

more info on www.aspfaqs.com > email.

same for attachments (but I guess you're using VB?)
0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 8089840
nope... sorry mark...

ok first... here is a link that explains EVERY AND ALL functions/properties associated with CDONTS mailing object:

http://www.devasp.com/Samples/mail.asp

and here is how you set the priority/importance of a mail message:

using the same objMail object:

objMail.Importance="High" 'OR "Normal" OR "Low"

hope this helps...

MaxOvrdrv2

0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 8089847
so:

With iMsg
   Set .Configuration = iConf
   .To = strTo
   .From = strFrom
   .CC = strCc
   .BCC = strBcc
   .Subject = strSubject
   .HTMLBody = strTextBody
for i=1 to ubound(arrAttachment)
   .AddAttachment arrAttachment(0,i),arrAttachment(1,i),3  

next
   .Importance="High"
   .Send

MaxOvrdrv2
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:kven
ID: 8102368
Hi MaxOvrdrv2 and markhoy,

Can anyone of you help me in the next point (number 2) that I have mentioned.

I am setting up multiple attachments to the system. and I am able to send the mails with attachments. but it is taking the names as default names for the attachment, like "ATT10234" etc..


Venkat
0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 8102814
as far as i know... there is no way to change those... but then again... that's just me...

but also... as far as i know... the user can save his/her attachments to anything he/she would like... so it doesn't really matter now does it! ;-)

MaxOvrdrv2
0
 

Author Comment

by:kven
ID: 8102849
Hi MaxOvrdrv2,

We can change the name of the attachment. the second parameter that we are passing for the "attachment"  is ment for that only.

I tried that for single attachment. But I am not getting for the multiple attachments...:(

Venkat


0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 8102872
show me your attachment script...

MaxOvrdrv2
0
 

Author Comment

by:kven
ID: 8102958

that is as below..

for i=1 to ubound(arrAttachment)
  .AddAttachment Att_Path,att_Name,3  
next

so the above ones should do the job. I tried printing the name. for one attachment it is comming fine.
for multiple attachments the problem is comming.

remaining code is above. I copied this for convenience sake.

Venkat



0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 8103309
ok... ummm... how do you set your array that you use to get these names:??

for i=1 to ubound(arrAttachment)
  .AddAttachment arrAttachment(0,i),arrAttachment(1,i),3  
next

the arrAttachment(0,0)

have you tried outputting it's entire contents??

also.. make sure that if you are using a loop to populate it... that you are using REDIM PRESERVE when declaring it's size... just a thought...

but let me know how you populate that array...

MaxOvrdrv2
0
 

Author Comment

by:kven
ID: 8107525
Hi MaxOvrdrv2,

Thanks for the supporting ideas. I tried printing the values on to the page. they are comming properly.
I am fetching the details from database. the name and the path are from DB.

I am able to see the values properly on to the page.
even it is talking the path but not the name.
I just tried providing the hard coded value.

it is taking its own names not the one I provided as "TestName".



Venkat
 




0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 8111021
ok... try this:

for i=1 to ubound(arrAttachment)
 .AddAttachment "'" & arrAttachment(0,i)& "'","'" & arrAttachment(1,i),3 "'"  
next

Let me know...

MaxOvrdrv2
0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 8111033
forgot the last ampersand before the quotes.. my mistake... should read (copy and past this one!):

.AddAttachment "'" & arrAttachment(0,i)& "'","'" & arrAttachment(1,i),3 & "'"  

Cheers!

MaxOvrdrv2
0
 

Author Comment

by:kven
ID: 8111285
Hi MaxOvrdrv2,

this is a method so I don't think we need to give the ampersent etc..
".Attachment"  is a method. those two are the parameters for that. so don't need to give like that.

Venkat
 
0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 8111340
yes... but if that method accepts strings as arguments, then you must put the "'" single quotes attached to the value that is contained in the array... try it... see what it does...

MaxOvrdrv2

Max
0
 

Author Comment

by:kven
ID: 8252750
Dear Admin,
Can you Please close this question.
I got a good support from MaxOvrdrv2 my thanks to him.
I didn't get any answer for this.

Thanks & Regards,
Venkat
0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 8253731
have you at least tried it with the ampersands?

MaxOvrdrv2
0
 

Expert Comment

by:Didu
ID: 8558992
I'm using CDO (NOT CDONTS) for emailinf from ASP. I'm stuck up at setting the 'Importance' of the mail. I tried out
iMsg.Importance = 2 etc. but it errors with "Object doesn't support this property or method: 'Importance'". I tried with 'Priority' instead of 'Importance' but that doen't work too.

Can anyone give me a lead for this one?

Thanks in Advance
Didu.
0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 8559331
here are a couple of leads about setting mail prioriy using the CDO object... appearently... it only works/shows up in Outlook... and no other mail apps... but if this is the only mail app they will use... then this same link gives you an example of how to set prioriy using CDO:

http://www.dotnet247.com/247reference/msgs/27/136333.aspx

Priority:
MyMessage.Priority = Mail.MailPriority.Low
MyMessage.Priority = Mail.MailPriority.High

Cheers!

MaxOvrdrv2


0
 

Expert Comment

by:Didu
ID: 8559409
This didn't work out! Error says 'Mail' undefined.

More info regarding my environment: Using MS Exchange 2000 and Outlook only as client.

Any more help on this is highly appreciated.

Didu

0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 8559491
here are a few more links... i think the proper way to use this is System.Web.Mail.Priority or something like it:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebmail.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebmailmailpriorityclasstopic.asp

this is all i could find on setting mail priority using the CDO object instead of teh CDONTS object.

Cheers!

MaxOvrdrv2
0
 

Expert Comment

by:Didu
ID: 8559528
Those links are for .NET implementation which I'm not doing.

Thanks anyways Max.

Didu
0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 8559636
ok well... then there is no way to set it... as this is anything and everything i could find throughout all my links of ASP to use the CDO object.

MaxOvrdrv2
0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 8559646
why can't you use CDONTS instead?

MaxOvrdrv2
0
 

Expert Comment

by:Didu
ID: 8559687
I guess that is not supported in Win2K environment (the IIS box is moving to Win2K).

Didu
0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 8559824
try this as well

YourMailObject.Importance=2

MaxOvrdrv2
0
 

Expert Comment

by:Didu
ID: 8559852
If you see my 1st message, that is what I began with :(( No luck! It gives "object not supported"
0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 8559864
try this as well

YourMailObject.Importance=2

MaxOvrdrv2
0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 8559893
oh well... so much for that...

the answer in this case then... is that it can't be done... not by using CDO instead of CDONT...

Sorry...

MaxOvrdrv2
0
 
LVL 10

Accepted Solution

by:
MaxOvrdrv2 earned 150 total points
ID: 8559985
0
 

Author Comment

by:kven
ID: 8561557
Hi MaxOvrdrv2,

I am happy and very thankful for all the continous support from you for this problem. I am happy that you have done all the efforts that can be done to help a person.

And I also thank other guys for helping me a lot for this.


Thanks & Regards,
Venkat


0
 

Expert Comment

by:mcdullsong
ID: 8686708
Try this for the importance setting your emails.

dim oM
dim oC

Set oM = CreateObject("CDO.Message")
Set oC = CreateObject("CDO.Configuration")

with oC.Fields
   .item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
  .item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "C:\inetpub\mailroot\pickup"
  .update
end with

with oM
  set .Configuration = oC
  .from = "someone@somewhere"
  .to = "someone@somewhere"
  .subject = "test email"
  .textBody = "test body email"
  .fields.Item("urn:schemas:httpmail:importance") = 2    'or 0 or 1
  .fields.Update
end with

om.send
response.write "done"

Hope this helps.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

764 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