Solved

Sending Mails

Posted on 2009-07-07
4
249 Views
Last Modified: 2012-08-14
Iam sending mail with an Image in asp.net.

When Iam running(Debugging) this application from system, It is working properly but mails are going to Spam.

When Iam running(Debugging) this application from Server. Mails are going to C:\Inetpub\mailroot\Queue, but it's not delivering.

Finally I hosted in IIS. And Iam running through intermnet,At the time Iam getting the Exception like this  "Cannot get IIS pickup directory"

Please give the solution for this........
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", Port);
                    smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
                    mail.Priority = MailPriority.High;
                    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
4 Comments
 
LVL 9

Expert Comment

by:Rahul Goel ITIL
ID: 24801167
MailObj.PickupDirectoryLocation = "\\Isasrv\PickUp2"
MailObj.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory
0
 
LVL 9

Accepted Solution

by:
Rahul Goel ITIL earned 500 total points
ID: 24801173

Add these two line it will work!
 
 
mail.PickupDirectoryLocation = "\\Isasrv\PickUp2"
mail.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory

Open in new window

0
 

Author Comment

by:mannevenu
ID: 24801328
Dear Rahu....

I had added to line code which was given by you.
But Iam not getting PickupDirectoryLocation and DeliveryMethod function through mail object.
I got through smtp object. So I added in this way.

               smtp.PickupDirectoryLocation = "\\Isasrv\\PickUp2";
               smtp.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
when iam running through internet Iam getting the exception like this:  Failure sending mail.

Could give me the solution
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
In this article, I will show you HOW TO: Perform a Physical to Virtual (P2V) Conversion the easy way from a computer backup (image).
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

726 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