Solved

Sending email to Inbox

Posted on 2009-07-07
5
428 Views
Last Modified: 2012-05-07
Iam sendind email(s) with an Image(Image is an html view) from asp.net using system.net.mail by click in button, Iam takiingEmail Id's taking from Database.
When iam debugging from server,It is working perfectly.But when iam working through internet(in other system) it is giving an Exception  "Cannot get IIS pickup directory"

Please give me the solution.Thanks in advance......
string ToName=dtSelect.Rows[i][1].ToString();
                    string ToEmailID = dtSelect.Rows[i][2].ToString();
                    MailMessage mail = new MailMessage();
                    mail.To.Add(ToEmailID);
                    mail.Priority = MailPriority.High;
                    mail.From = new MailAddress("info@isitech.edu.in","ISiTech");
                    mail.Subject = "ISiTech BRIDGE Program";
                    string Body = "<b>Dear "+ToName+" !!!</b><br><img alt=\"\" hspace=0 src=\"cid:imageId\" align=baseline border=0 ><br> For More Details  www.isitech.edu.in";
                    AlternateView htmlView = AlternateView.CreateAlternateViewFromString(Body, null, "text/html");
                    LinkedResource imagelink = new LinkedResource(Server.MapPath(".") + @"\bridge.jpg", "image/jpeg");
                    imagelink.ContentId = "imageId";
                    imagelink.TransferEncoding = System.Net.Mime.TransferEncoding.Base64;
                    htmlView.LinkedResources.Add(imagelink);
                    mail.AlternateViews.Add(htmlView);
                    SmtpClient smtp = new SmtpClient("Here I gave System IP Address", 25);
                    smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
                    smtp.Send(mail);

Open in new window

0
Comment
Question by:mannevenu
  • 2
5 Comments
 
LVL 19

Expert Comment

by:Melih SARICA
ID: 24792031
why to use method pivkupDirectoryFromIIS  ?
0
 
LVL 19

Expert Comment

by:Melih SARICA
ID: 24792041

and the reason is u got the worksererror is permissions to access that directory..

While ur debugging i guess u have  administrator previligies.. but on product system ur app is running with networkservice account.. give network service account read and write permissions to inetpub\mailroot directory..

0
 
LVL 9

Accepted Solution

by:
Rahul Goel ITIL earned 500 total points
ID: 24792417
Set the pickup location

MailObj.PickupDirectoryLocation = "\\Isasrv\PickUp2"
MailObj.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory
0
 

Author Comment

by:mannevenu
ID: 24792624
Hi Rahu Ketu patal,

I gave the path.But iam getting the same exception.
Is there another way?
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

813 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now