Solved

Sending email to Inbox

Posted on 2009-07-07
5
432 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
[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
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

688 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