Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > .NET Framework > Forum > ส่งเมล์แล้วขึ้น error ยังงี้ Server does not support secure connections. หมายตวามว่ายังงัยครับ



 

ส่งเมล์แล้วขึ้น error ยังงี้ Server does not support secure connections. หมายตวามว่ายังงัยครับ

 



Topic : 024323



โพสกระทู้ ( 8 )
บทความ ( 0 )



สถานะออฟไลน์




protected void ButtonSubmit_Click(object sender, EventArgs e)

{

System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();

msg.To.Add("[email protected]");

msg.To.Add("[email protected] ");

msg.From = new MailAddress("[email protected]", "Admin", System.Text.Encoding.UTF8);

msg.Subject = "Test mail using .net2.0";

msg.SubjectEncoding = System.Text.Encoding.UTF8;

msg.Body = "This is my msg Body test";

msg.BodyEncoding = System.Text.Encoding.UTF8;

msg.IsBodyHtml = false;

msg.Priority = MailPriority.High;

SmtpClient client = new SmtpClient();

client.Credentials = new System.Net.NetworkCredential("[email protected] ", "******");

client.Port = 25;//or use 587 465

client.Host = "localhost";

client.EnableSsl = true;

client.SendCompleted += new SendCompletedEventHandler(client_SendCompleted);

object userState = msg;

try

{

client.SendAsync(msg, userState);

}

catch (System.Net.Mail.SmtpException ex)

{

Response.write (ex.Message);

}




}



void client_SendCompleted(object sender, AsyncCompletedEventArgs e)

{

MailMessage mail = (MailMessage)e.UserState;

string subject = mail.Subject;

if (e.Cancelled)

{

string cancelled = string.Format("[{0}] Send canceled.", subject);

Page.RegisterClientScriptBlock("OnLoad", "<SCRIPT>alert('" + cancelled + "');</SCRIPT>");

}

if (e.Error != null)

{

string error = String.Format("[{0}] {1}", subject, e.Error.ToString());

}

else

{

}

}


พอกดส่งแล้วมันจะขึ้น Error ครับ
Server does not support secure connections.
อันนี้เป็น Web.config เอามาให้ดูครับ

Web.config
<?xml version="1.0"?>

<!--

Note: As an alternative to hand editing this file you can use the

web admin tool to configure settings for your application. Use

the Website->Asp.Net Configuration option in Visual Studio.

A full list of settings and comments can be found in

machine.config.comments usually located in

\Windows\Microsoft.Net\Framework\v2.x\Config

-->

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

<appSettings/>

<connectionStrings>

<add name="DataAlumni" connectionString="Data Source=.\sqlexpress;Initial Catalog=DataAlumni;Integrated Security=True"

providerName="System.Data.SqlClient" />

<add name="DataAlumniConnectionString" connectionString="Data Source=.\SQLExpress;Initial Catalog=DataAlumni;Integrated Security=True"

providerName="System.Data.SqlClient" />

</connectionStrings>

<system.web>

<!--

Set compilation debug="true" to insert debugging

symbols into the compiled page. Because this

affects performance, set this value to true only

during development .

-->

<authorization>

<deny roles="smtp.gmail.com" />

</authorization>

<compilation debug="true">

</compilation>

<!--

The <authentication> section enables configuration

of the security authentication mode used by

ASP.NET to identify an incoming user.

-->

<authentication mode="Forms" />

<!--

The <customErrors> section enables configuration

of what to do if/when an unhandled error occurs

during the execution of a request. Specifically,

it enables developers to configure html error pages

to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">

<error statusCode="403" redirect="NoAccess.htm" />

<error statusCode="404" redirect="FileNotFound.htm" />

</customErrors>

-->

<globalization uiCulture="th"/>

</system.web>

<!--<system.net>

<mailSettings>

<smtp from="">

<network host="" password="" port="1984" userName="" />

</smtp>

</mailSettings>

</system.net>-->

</configuration>


ช่วยแนะนำด้วยนะครับว่าต้องแก้อะไรบ้าง ผมอยากจะลองส่งในเครื่องของตัวเองดูก่อนนะครับ



Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2009-01-27 11:21:23 By : D_jack View : 3808 Reply : 8
 

 

No. 1



โพสกระทู้ ( 4 )
บทความ ( 0 )



สถานะออฟไลน์


ผมสงสัยว่าไม่เซ็ทค่า smtp แล้วส่งได้ด้วยหรอครับ






Date : 2009-01-27 13:11:05 By : tun_sdu
 


 

No. 2



โพสกระทู้ ( 8 )
บทความ ( 0 )



สถานะออฟไลน์


แล้วต้องเซ็ทตรงไหนครับ ผมไม่เคยทำมาก่อน ยังงัยช่วยบอกด้วยนะครับ
Date : 2009-01-27 14:19:04 By : D_jack
 

 

No. 3



โพสกระทู้ ( 4 )
บทความ ( 0 )



สถานะออฟไลน์


ของผมเขียนงี้อะ SmtpClient SMTPServer = new SmtpClient("smtp.gmail.com");
Date : 2009-01-27 15:02:33 By : tun_sdu
 


 

No. 4



โพสกระทู้ ( 8 )
บทความ ( 0 )



สถานะออฟไลน์


เดี๋ยวจะลองดูนะครับ
Date : 2009-01-27 21:35:10 By : D_jack
 


 

No. 5



โพสกระทู้ ( 8 )
บทความ ( 0 )



สถานะออฟไลน์


พี่ครับช่วยอธิบายตรง client.EnableSsl ให้หน่อยได้มัยครับว่ามันคืออะไร ตอนนี้ถ้าผมปลี่ยนจาก
client.EnableSsl = true;
เป็น

client.EnableSsl = false;


มันสามารถส่งไปที่ C:\Inetpub\mailroot\Queue ได้ครับ

แต่ถ้าผม set ให้เป็นแบบนี้

client.Port = 587;//or use 587 465
client.Host = "smtp.gmail.com";
client.EnableSsl = false;




มันไม่สามารถส่งออกไปที่ email ได้ครับ มันจะ error ยังงี้ครับ Failure sending mail.

แล้วทีนี้ผมจะทำยังงัยต่อครับ

*ผมใช้เน็ตของมหาลัยอยู่นะครับ เป็น Wireless ครับ ผมจะต้อง set ค่ายังงัยบ้างครับ*
Date : 2009-01-27 22:45:53 By : D_jack
 


 

No. 6



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ปกติแล้วถ้าอยู่ใน Queue ก็ถือว่าการส่งอีเมล์สำเร็จน่ะครับ เพราะถ้านำไปใช้งานจริง ๆ ก็สามารถส่งออกไปได้อย่างแน่นอนครับ ส่วน

Code
client.Port = 587;//or use 587 465
client.Host = "smtp.gmail.com";
client.EnableSsl = false;


Google เค้ายอมให้ใช้เหรอครับ
Date : 2009-01-28 07:18:06 By : webmaster
 


 

No. 7



โพสกระทู้ ( 8 )
บทความ ( 0 )



สถานะออฟไลน์


แล้วถ้ายังงั้นผมสามารถใช้ stmp ของอะไรได้บ้างครับแล้วจะต้องสมัครมัยครับ
Date : 2009-01-28 16:54:38 By : D_jack
 


 

No. 8



โพสกระทู้ ( 8 )
บทความ ( 0 )



สถานะออฟไลน์


ได้แล้วครับ ดีใจจริงๆตอนนี้ผมแก้เป็นแบบนี้ครับ

client.Port = 25;//or use 587 465
client.Host = "smtp.gmail.com";
client.EnableSsl = true;


ต้องขอขอบคุณ คุณ tun และคุณMR.WIN มากๆนะครับ ที่ค่อยช่วยชี้แนะต่างๆขอบคุณจริงครับ
Date : 2009-01-28 20:40:05 By : D_jack
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ส่งเมล์แล้วขึ้น error ยังงี้ Server does not support secure connections. หมายตวามว่ายังงัยครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 01
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่