Solved

Sending Mails

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

Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

Question has a verified solution.

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

Background Information Recently I have fixed file server permission issues for one of my client. The client has 1800 users and one Windows Server 2008 R2 domain joined file server with 12 TB of data, 250+ shared folders and the folder structure i…
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…
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

691 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