Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2505
  • Last Modified:

how to set cdo message mail priority and Setting attachment Name

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
kven
Asked:
kven
  • 17
  • 7
  • 5
  • +2
1 Solution
 
markhoyCommented:
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
 
MaxOvrdrv2Commented:
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
 
MaxOvrdrv2Commented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
kvenAuthor Commented:
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
 
MaxOvrdrv2Commented:
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
 
kvenAuthor Commented:
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
 
MaxOvrdrv2Commented:
show me your attachment script...

MaxOvrdrv2
0
 
kvenAuthor Commented:

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
 
MaxOvrdrv2Commented:
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
 
kvenAuthor Commented:
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
 
MaxOvrdrv2Commented:
ok... try this:

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

Let me know...

MaxOvrdrv2
0
 
MaxOvrdrv2Commented:
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
 
kvenAuthor Commented:
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
 
MaxOvrdrv2Commented:
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
 
kvenAuthor Commented:
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
 
MaxOvrdrv2Commented:
have you at least tried it with the ampersands?

MaxOvrdrv2
0
 
DiduCommented:
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
 
MaxOvrdrv2Commented:
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
 
DiduCommented:
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
 
MaxOvrdrv2Commented:
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
 
DiduCommented:
Those links are for .NET implementation which I'm not doing.

Thanks anyways Max.

Didu
0
 
MaxOvrdrv2Commented:
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
 
MaxOvrdrv2Commented:
why can't you use CDONTS instead?

MaxOvrdrv2
0
 
DiduCommented:
I guess that is not supported in Win2K environment (the IIS box is moving to Win2K).

Didu
0
 
MaxOvrdrv2Commented:
try this as well

YourMailObject.Importance=2

MaxOvrdrv2
0
 
DiduCommented:
If you see my 1st message, that is what I began with :(( No luck! It gives "object not supported"
0
 
MaxOvrdrv2Commented:
try this as well

YourMailObject.Importance=2

MaxOvrdrv2
0
 
MaxOvrdrv2Commented:
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
 
MaxOvrdrv2Commented:
0
 
kvenAuthor Commented:
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
 
mcdullsongCommented:
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

  • 17
  • 7
  • 5
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now