[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Sending Mails

Posted on 2009-07-07
4
Medium Priority
?
256 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 1500 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] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
Know the reasons and solutions to move/import EDB to New Exchange Server. Also, find out how to recover an Exchange .edb file and to restore the file back.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

650 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