PDA

View Full Version : Báo lỗi khi gởi email đi



NgocHien
20-07-2003, 17:02
Em viết hàm gởi email sao nó báo lỗi như vầy trên Localhost, em kiểm tra kỹ rồi, nó ko sai chổ nào hết, ai cú em với !

Server Error in '/new' Application.
--------------------------------------------------------------------------------

The "SendUsing" configuration value is invalid.
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.Runtime.InteropServices.COMException: The "SendUsing" configuration value is invalid.

Source Error:


Line 213:
Line 214: ' Gởi email đi
Line 215: SmtpMail.Send( objMailMessage )
Line 216: '**********************************************K t thúc
Line 217: End If

White_Rose
20-07-2003, 22:40
Trên máy phải cài SMTP server. Mà từ localhost thì...

puppy
21-07-2003, 08:32
Bạn có thể dùng cơ chế try{} catch để báo lỗi thân thiện hơn.

Như vầy nè.

try
{
//Send your email here
}
catch(Exception err)
{
Response.Write("Can not send your email. Error: " + err.Message);
}

BigBug
21-07-2003, 10:20
Bạn post hết cái code send mail lên xem nào. Chắc là dùng cái gói System.Web.Mail của .Net phải không? Nếu dùng gói này thì không send mail tren internet được (chỉ send được khi test trong LAN thôi - tôi cũng bị như vậy).
Hiện tôi đang dùng 1 dll khác để send mail.

puppy
21-07-2003, 10:57
System.Web.Mail có thể gởi mail trên internet được mà. Ăn thua là cái SmtpServer có đúng hay không thôi.

1011
22-07-2003, 09:34
Để gửi mail được thì máy phải connect trực tiếp với Internet.

haji
22-07-2003, 14:44
gửi mail ở localhost thì smtp thế nào vậy ????

puppy
23-07-2003, 14:01
Gởi ở localhost thì không cần set property SMTPServer. Khi không set property SMTPServer thì .NET sẽ hiểu là server là localhost.