'/'应用程序中的服务器错误。服务器不支持安全连接。 [英] Server Error in '/' Application. Server does not support secure connections.
问题描述
我正在asp.net上为我们的公司网站联系美国页面。
我的confige文件代码是Flollowing。
< configuration>
< system.web>
< customErrors mode =OffdefaultRedirect =mycustompage.htm/ >
< /system.web>
< system.net>
< mailSettings>
< smtp deliveryMethod =Networkfrom =SomeWebsite Admin& lt; sales @ exact& gt;>
< network host =mail.precisetport =25 enableSsl =truedefaultCredentials =false
userName =sales@pret.capassword =secert/>
< / smtp>
< / mailSettings>
< /system.net>
< system.webServer>
< directoryBrowse enabled =true/>
< /system.webServer>
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]
我不知道我的outlook ID和密码错了吗?如果Outlook ID和密码问题,那么它会是什么?
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
推荐答案
来自= new MailAddress的邮件地址(txtemail.Text);
错了。服务器无法代表外国用户发送电子邮件 - 在电子邮件文本中添加与您联系的用户的电子邮件地址。
配置文件的smtp配置的表单部分看起来好的,但手动设置from属性会覆盖。
MailAddress from = new MailAddress(txtemail.Text);
is wrong. The server cannot send an email on behalf of a foreign user - add the email address of the user contacting you somewhere in the email text.
The "form" part of the smtp configuration of your config file looks ok, but setting the from property manually overwrites that.
这篇关于'/'应用程序中的服务器错误。服务器不支持安全连接。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!