mathieu_cupryk
asked on
how do I setup my webconfig for smtp?
I need to setup smtp with the below for asp.net 3.5
<system.net>
<mailSettings>
<!-- <smtp deliveryMethod="Network"> -->
<smtp deliveryMethod="PickupDire ctoryFromI is" from="webmaster@omegalove. com">
<network defaultCredentials="true" host="omegalove.com)" port="25" />
</smtp>
</mailSettings>
</system.net>
any help would be appreciated.
Iget the following errror:
get the following error.
Cannot get IIS pickup directory.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.Mail.SmtpExcept ion: Cannot get IIS pickup directory.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SmtpException: Cannot get IIS pickup directory.]
System.Net.Mail.IisPickupD irectory.G etPickupDi rectory() +1101325
System.Net.Mail.SmtpClient .Send(Mail Message message) +1480
System.Web.UI.WebControls. LoginUtil. SendPasswo rdMail(Str ing email, String userName, String password, MailDefinition mailDefinition, String defaultSubject, String defaultBody, OnSendingMailDelegate onSendingMailDelegate, OnSendMailErrorDelegate onSendMailErrorDelegate, Control owner) +367
System.Web.UI.WebControls. PasswordRe covery.Att emptSendPa sswordUser NameView() +537
System.Web.UI.WebControls. PasswordRe covery.Att emptSendPa ssword() +55
System.Web.UI.WebControls. PasswordRe covery.OnB ubbleEvent (Object source, EventArgs e) +103
System.Web.UI.Control.Rais eBubbleEve nt(Object source, EventArgs args) +37
System.Web.UI.WebControls. Button.OnC ommand(Com mandEventA rgs e) +118
System.Web.UI.WebControls. Button.Rai sePostBack Event(Stri ng eventArgument) +166
System.Web.UI.WebControls. Button.Sys tem.Web.UI .IPostBack EventHandl er.RaisePo stBackEven t(String eventArgument) +10
System.Web.UI.Page.RaisePo stBackEven t(IPostBac kEventHand ler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePo stBackEven t(NameValu eCollectio n postData) +36
System.Web.UI.Page.Process RequestMai n(Boolean includeStagesBeforeAsyncPo int, Boolean includeStagesAfterAsyncPoi nt) +1565
-------------------------- ---------- ---------- ---------- ---------- ---------- ----
<system.net>
<mailSettings>
<!-- <smtp deliveryMethod="Network"> -->
<smtp deliveryMethod="PickupDire
<network defaultCredentials="true" host="omegalove.com)" port="25" />
</smtp>
</mailSettings>
</system.net>
any help would be appreciated.
Iget the following errror:
get the following error.
Cannot get IIS pickup directory.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.Mail.SmtpExcept
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SmtpException: Cannot get IIS pickup directory.]
System.Net.Mail.IisPickupD
System.Net.Mail.SmtpClient
System.Web.UI.WebControls.
System.Web.UI.WebControls.
System.Web.UI.WebControls.
System.Web.UI.WebControls.
System.Web.UI.Control.Rais
System.Web.UI.WebControls.
System.Web.UI.WebControls.
System.Web.UI.WebControls.
System.Web.UI.Page.RaisePo
System.Web.UI.Page.RaisePo
System.Web.UI.Page.Process
--------------------------
ASKER
Cannot get IIS pickup directory.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.Mail.SmtpExcept ion: Cannot get IIS pickup directory.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.Mail.SmtpExcept
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
ASKER
I got an email from the host to do the following:
i am confused:
It is mandatory to use SMTP authentication for sending out emails through our servers. You can use the below sample C# code for the same (by making required modifications):
************************** ********** ********** ********** ********** ********** *******
SmtpClient smtpClient = new SmtpClient();
MailMessage message = new MailMessage();
MailAddress fromAddress = new MailAddress("from@from.com ", "From Name");
// You can specify the host name or ipaddress of your server
smtpClient.Host = "mail.yoursite.com"; //you can also specify mail server IP address here
//Default port will be 25
smtpClient.Port = 25;
NetworkCredential info = new NetworkCredential("smtpuse r@yoursite .com", "smtp-password");
smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network ;
smtpClient.UseDefaultCrede ntials = false;
smtpClient.Credentials = info;
//From address will be given as a MailAddress Object
message.From = fromAddress;
// To address collection of MailAddress
message.To.Add("to@domain2 .com");
message.Subject = "Your subject";
// CC and BCC optional
// MailAddressCollection class is used to send the email to various users
// You can specify Address as new MailAddress("admin1@yoursi te.com")
//message.Bcc.Add("bcc@you rsite.com" );
//Body can be Html or text format
//Specify true if it is html message
message.IsBodyHtml = false;
// Message body content
string ss_body = "body of email is here";
message.Body = ss_body;
// Send SMTP mail
smtpClient.Send(message);
************************** ********** ********** ********** ********** ********** *******
I though I only needed to modify my webconfig? please help.
i am confused:
It is mandatory to use SMTP authentication for sending out emails through our servers. You can use the below sample C# code for the same (by making required modifications):
**************************
SmtpClient smtpClient = new SmtpClient();
MailMessage message = new MailMessage();
MailAddress fromAddress = new MailAddress("from@from.com
// You can specify the host name or ipaddress of your server
smtpClient.Host = "mail.yoursite.com"; //you can also specify mail server IP address here
//Default port will be 25
smtpClient.Port = 25;
NetworkCredential info = new NetworkCredential("smtpuse
smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network
smtpClient.UseDefaultCrede
smtpClient.Credentials = info;
//From address will be given as a MailAddress Object
message.From = fromAddress;
// To address collection of MailAddress
message.To.Add("to@domain2
message.Subject = "Your subject";
// CC and BCC optional
// MailAddressCollection class is used to send the email to various users
// You can specify Address as new MailAddress("admin1@yoursi
//message.Bcc.Add("bcc@you
//Body can be Html or text format
//Specify true if it is html message
message.IsBodyHtml = false;
// Message body content
string ss_body = "body of email is here";
message.Body = ss_body;
// Send SMTP mail
smtpClient.Send(message);
**************************
I though I only needed to modify my webconfig? please help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<network defaultCredentials="true" host="omegalove.com)" port="25" />
<network defaultCredentials="true" host="omegalove.com" port="25" />
one more suggestion
in the above line remove defaultCredentials and put in a valid domain user name and password and try agian
<network host="omegalove.com" port="25" userName="username" password="password"/>