|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
ASP Email With Attachments Failure using CDO.Message
I'm using this code to send a e-mail with attachment: Dim oCdoMail Set oCdoMail = Server.CreateObject("CDO.Message") oCdoMail.From = strFromEmail oCdoMail.To = strToEmail oCdoMail.Subject = "Job Information" oCdoMail.TextBody = "This is the email notification" oCdoMail.AddAttachment strFileName oCdoMail.Configuration.Fields.Item=2 oCdoMail.Configuration.Fields.Item=<My mail server IP> oCdoMail.Send This code scuccessfully send mail with attchment on my local. But when we uplaod this code to the web server this is forceing error. If i mark comment the folowing code "oCdoMail.AddAttachment strFileName" this will work fine on the server, but i need to send e-mail with attachments. how it could be possible ? Please help me and suggest the way ASAP. Thanks in Advance Naveen Jain OTS Solutions Pvt. Ltd., Guraon (India)
Show quote
"Naveen Jain" <NaveenJ***@discussions.microsoft.com> wrote in message It would help if you tolds what error you are getting?news:2E1DDDBD-16AA-46A2-9BF5-5F3591FCDA48@microsoft.com... > Hi All, > > I'm using this code to send a e-mail with attachment: > > Dim oCdoMail > Set oCdoMail = Server.CreateObject("CDO.Message") > oCdoMail.From = strFromEmail > oCdoMail.To = strToEmail > oCdoMail.Subject = "Job Information" > oCdoMail.TextBody = "This is the email notification" > oCdoMail.AddAttachment strFileName > oCdoMail.Configuration.Fields.Item=2 > oCdoMail.Configuration.Fields.Item=<My mail server IP> > oCdoMail.Send > > This code scuccessfully send mail with attchment on my local. But when we > uplaod this code to the web server this is forceing error. If i mark comment > the folowing code > "oCdoMail.AddAttachment strFileName" this will work fine on the server, but > i need to send e-mail with attachments. how it could be possible ? > > Please help me and suggest the way ASAP. Also how does this manage to work at all:- oCdoMail.Configuration.Fields.Item=2 oCdoMail.Configuration.Fields.Item=<My mail server IP> I suspect you meant:- oCdoMail.Configuration.Fields.Item=2 oCdoMail.Configuration.Fields.Item=<My mail server IP> With oCdoMail.Configuration.Fields .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = IP address .Update ' You had this missing as well End With Also did you change the IP address to something the Web server can access? Does the Web server not already have the configuration set correctly to send emails? Consider creating your own instance of the Configuration object like this:- Dim oConf : Set oConf = Server.CreateObject("CDO.Configuration") With oConf .Configuration .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = IP address .Update End With Set oCdoMail.Configuration = oConf This avoids any conflicting values in the default configuration messing up what you are trying to do. Show quote > Thanks in Advance > > Naveen Jain > OTS Solutions Pvt. Ltd., > Guraon (India) > |
|||||||||||||||||||||||