Solved

Sending Mails

Posted on 2009-07-07
4
238 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

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

If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup". After a while, you have entered a loop for Auto repair which does not fix anything and you will be in a  panic as all your work w…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

707 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

12 Experts available now in Live!

Get 1:1 Help Now