I'm Making Contact US Page for our company site in asp.net .
my confige files code is Flollowing .
<configuration>
<system.web>
<customErrors mode="Off" defaultRedirect="mycustompage.htm"/>
</system.web>
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="SomeWebsite Admin <sales@precise>">
<network host="mail.preciset" port="25" enableSsl="true" defaultCredentials="false"
userName="sales@pret.ca" password="secert" />
</smtp>
</mailSettings>
</system.net>
<system.webServer>
<directoryBrowse enabled="true" />
</system.webServer>
And I've following Code in .cs files c# code
SmtpClient smtp = new SmtpClient();
MailAddress to = new MailAddress("sales@precis.ca");
MailAddress from = new MailAddress(txtemail.Text);
MailMessage mail = new MailMessage(from, to);
mail.Body = "From:" + txtname.Text + "\n" + "Email: " + txtemail.Text + "\n" + " His Question: " + txtmsg.Text + "\n" + " Contact NO: " + txtcontact.Text;
try
{
smtp.Send(mail);
}
catch (Exception ex)
{
throw ex;
}
I'm using outlook ID and Passord .
I getting this error
*************************************************************************
Server Error in '/' Application.
Server does not support secure connections.
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.SmtpException: Server does not support secure connections.
Source Error:
Line 36: {
Line 37:
Line 38: throw ex; Line 39: }
Line 40: }
Source File: ContactUs.aspx.cs Line: 38
Stack Trace:
[SmtpException: Server does not support secure connections.]
Services.Button1_Click(Object sender, EventArgs e) in c:\HostingSpaces\ContactUs.aspx.cs:38
**************************************************************************
And when I change a line in Config files, i put False eg .(enableSsl="false")
Then i get Following Error :
Server Error in '/' Application.
Mailbox unavailable. The server response was: From address must match authenticated address
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.SmtpException: Mailbox unavailable. The server response was: From address must match authenticated address
Source Error:
Line 36: {
Line 37:
Line 38: throw ex; Line 39: }
Line 40: }
[SmtpException: Mailbox unavailable. The server response was: From address must match authenticated address]
I donot know is its Wrong with my outlook id and password?? if Outlook id and password problem,then what its would be ??
Please some one help me , give me solution , I've also post this Question in asp.net office site Furm but could not get help ..Hope from Codeproject