Hi, I have a form where a user asks for a quote and we need to send an attached application form. all this worked in the dev environment but when I post the changes onto our hosted server (third party ISP) I get an error when the attachment is added. I have
tired to use URL's but that does not work, at the moment I am using a relative path, but have also tried to place the file in the forms page folder.
, oops. I have a batch file that posts the latest files to the site, and the batch file did not cater for
pdf files LOL. When I ftp'd onto the site I find you were right.
Thanks, explains why I could not find an article that could help lol.
Warren Macha...
Member
65 Points
50 Posts
Email attachmenet onluy works in dev environment, not on hosted server
Feb 05, 2010 02:47 PM|LINK
Hi, I have a form where a user asks for a quote and we need to send an attached application form. all this worked in the dev environment but when I post the changes onto our hosted server (third party ISP) I get an error when the attachment is added. I have tired to use URL's but that does not work, at the moment I am using a relative path, but have also tried to place the file in the forms page folder.
Here is my attachment code:
string strFullPath = System.Web.HttpContext.Current.Server.MapPath(pRelativePath);
Attachment myAttachment = new Attachment(strFullPath, System.Net.Mime.MediaTypeNames.Application.Pdf);
myMsg.Attachments.Add(myAttachment);
this is in a try - catch block and I get the error "Could not find file".
mail attachment asp.net c#
rtpHarry
All-Star
56620 Points
8958 Posts
Re: Email attachmenet onluy works in dev environment, not on hosted server
Feb 05, 2010 03:13 PM|LINK
This might be obvious but.... it cant find the file [:)]
Try checking the value of strFullPath to make sure it has resolved correctly.
Have you checked pRelativePath is a proper path?
Warren Macha...
Member
65 Points
50 Posts
Re: Email attachmenet onluy works in dev environment, not on hosted server
Feb 06, 2010 03:59 AM|LINK
Thanks, explains why I could not find an article that could help lol.
stupid mistake