Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Frnds,
I have problem with smtp server.I AM ABLE TO SEND MAIL FROM MY LOCAL SERVER.However when I upload the files to server am getting the below error.
'Cannot Get IIS Pickup Directory'
please help me soon.My code is below.once again I remember u its working fine in my local system.


SmtpClient mail_client = new SmtpClient();
mail_client.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.PickupDirectoryFromIis;
System.Net.NetworkCredential network_cdr = new System.Net.NetworkCredential();
network_cdr.UserName = uname;
network_cdr.Password = pwd;

mail_client.Credentials = network_cdr;
mail_client.Port = 26;
mail_client.Host = mailhost;
mail_client.Send(email_msg);
Posted

1 solution

hey Radhika i was getting same error on windows server 2008 R2 when i write belove code i got sollution.. use Gmail smtp client
SmtpClient SmtpServer = new SmtpClient();
SmtpServer.Credentials = new Net.NetworkCredential("xyz@gmail.com", "password");
SmtpServer.Port = 587;
SmtpServer.Host = "smtp.gmail.com";
SmtpServer.EnableSsl = true;

mail = new MailMessage();
mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
mail.ReplyTo = new MailAddress(TextBox1.Text);
SmtpServer.Send(mail);

Hope this will work for u...Kishan Ki Radha jI...
 
Share this answer
 
v2
Comments
Radhika Vyas 28-Nov-12 7:33am    
I cant use gmail authentication..I need to use smtp details of client..Ur code is not working for me
Devang Vaja 28-Nov-12 8:18am    
hey by this code u can send on client Email id but This mail will go through Your gmail account and it is smtp client code but uses only gmail authentication that's difference Radha ji..
Have u tried this code???
Devang Vaja 29-Nov-12 0:22am    
MailMessage MyMsg = default(MailMessage);

SmtpClient MySmtp = default(SmtpClient);string StrTo = null;

string StrFrom = null;string StrSubject = null;string StrBody = null;

string StrTMsg = null;try { StrTo = StrTTo; StrFrom = "coolrocker.vaja@gmail.com";

StrSubject = StrTSub; StrTMsg = ""; StrTMsg = S.ToString; StrBody = StrTMsg;

MyMsg = new MailMessage(StrFrom, StrTo, StrSubject, StrBody);

MyMsg.IsBodyHtml = true; MySmtp = new SmtpClient("localhost");

MySmtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;

MySmtp.Send(MyMsg);} catch (Exception ex) {}Use This
abhi10 6-Sep-14 6:11am    
Hi Frnds,
I have problem with smtp server.I can't ABLE TO SEND MAIL FROM MY LOCAL SERVER. I am getting the below error.
'Cannot Get IIS Pickup Directory'
please help me soon.My code is below.once again I remember u its working fine in my local system.



SmtpClient sc = new SmtpClient("localhost");
sc.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
sc.Send(txtFrom.Text, txtTo.Text, txtSubject.Text, txtMsg.Text);
lblShow.Text = "Mail Sent Sucessfully";

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900