Solved

Sending Mails

Posted on 2009-07-07
4
240 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
  • 2
4 Comments
 
LVL 9

Expert Comment

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

Accepted Solution

by:
Rahul Goel 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

[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

Question has a verified solution.

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

Suggested Solutions

This is an article about Leadership and accepting and adapting to new challenges. It focuses mostly on upgrading to Windows 10.
A Bare Metal Image backup allows for the restore of an entire system to a similar or dissimilar hardware. They are highly useful for migrations and disaster recovery. Bare Metal Image backups support Full and Incremental backups. Differential backup…
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
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.

920 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

15 Experts available now in Live!

Get 1:1 Help Now