Solved

Sending email to Inbox

Posted on 2009-07-07
5
424 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 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

757 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

17 Experts available now in Live!

Get 1:1 Help Now