Questions about SmtpMail class of ASP.NET

E

Edward

Hello, everybody,

I tried to send Email out using ASP.NET, but failed, here is the code of sending:

--------------------------------------------------------------------------------


Try
Try
'SmtpMail.SmtpServer = "smtp.citiz.net"
SmtpMail.Send(msg)
Catch ehttp As System.Web.HttpException
lstError.Items.Add(ehttp.Message)
lstError.Items.Add("Here is the full error message")
lstError.Items.Add(ehttp.ToString())
txtError.Text = "["+SmtpMail.SmtpServer + "]" + ehttp.ToString()
End Try
Catch eSystem As System.Exception
' Display text of unknown error.
lstError.Items.Add("Unknown Exception occurred 0" + eSystem.Message)
lstError.Items.Add("Here is the Full Error Message")
lstError.Items.Add(eSystem.ToString())
End Try


--------------------------------------------------------------------------------

I've two questions:
the first is , if I open local SMTP service provided with my OS: Win 2000 professional, the code above gives me nothing, only put the mail message in the directory C:\Inetpub\mailroot\Queue, so when will it be sent out ? do i need something else to be configured ?

the second is , if I choose the outside SMTP server , assign the value to Smtpmail.Smtpserver, where can I set the authentication information ? as you know, nearly all the SMTP server now ask you to use Authentication . I cannot find the result .


whether you can give me the answer or not, I should say Thanks to everybody who take a look at this mail.

Edward , CHINA
 
L

Lau Lei Cheong

Quoted for a search to
Goggle(http://www.sitepoint.com/forums/showthread.php?t=98815):

Dim Msg As New System.Web.Mail.MailMessage
Msg.Fields("http://schemas.microsoft.com/cdo/configuration/smtsperver") =
"remoteserver"
Msg.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport")
= 25
Msg.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
Msg.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
) = 1
Msg.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") =
"username"
Msg.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") =
"password"
Msg.To = "(e-mail address removed)"
Msg.From = "(e-mail address removed)"
Msg.Subject = "Subject"
Msg.BodyFormat = Mail.MailFormat.Html
Msg.Body = "Message"

System.Web.Mail.SmtpMail.SmtpServer = "remoteserver"
System.Web.Mail.SmtpMail.Send(Msg)


"Edward" <[email protected]> ÔÚà]¼þ ÖÐ׫Œ‘...
Hello, everybody,

I tried to send Email out using ASP.NET, but failed, here is the code of
sending:




Try
Try
'SmtpMail.SmtpServer = "smtp.citiz.net"
SmtpMail.Send(msg)
Catch ehttp As System.Web.HttpException
lstError.Items.Add(ehttp.Message)
lstError.Items.Add("Here is the full error message")
lstError.Items.Add(ehttp.ToString())
txtError.Text = "["+SmtpMail.SmtpServer + "]" + ehttp.ToString()
End Try
Catch eSystem As System.Exception
' Display text of unknown error.
lstError.Items.Add("Unknown Exception occurred 0" + eSystem.Message)
lstError.Items.Add("Here is the Full Error Message")
lstError.Items.Add(eSystem.ToString())
End Try




I've two questions:
the first is , if I open local SMTP service provided with my OS: Win
2000 professional, the code above gives me nothing, only put the mail
message in the directory C:\Inetpub\mailroot\Queue, so when will it be
sent out ? do i need something else to be configured ?

the second is , if I choose the outside SMTP server , assign the
value to Smtpmail.Smtpserver, where can I set the authentication information
? as you know, nearly all the SMTP server now ask you to use Authentication
.. I cannot find the result .


whether you can give me the answer or not, I should say Thanks to
everybody who take a look at this mail.

Edward , CHINA
 
T

Teemu Keiski

http://www.systemwebmail.com/

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke

Hello, everybody,

I tried to send Email out using ASP.NET, but failed, here is the code of sending:

------------------------------------------------------------------------------


Try
Try
'SmtpMail.SmtpServer = "smtp.citiz.net"
SmtpMail.Send(msg)
Catch ehttp As System.Web.HttpException
lstError.Items.Add(ehttp.Message)
lstError.Items.Add("Here is the full error message")
lstError.Items.Add(ehttp.ToString())
txtError.Text = "["+SmtpMail.SmtpServer + "]" + ehttp.ToString()
End Try
Catch eSystem As System.Exception
' Display text of unknown error.
lstError.Items.Add("Unknown Exception occurred 0" + eSystem.Message)
lstError.Items.Add("Here is the Full Error Message")
lstError.Items.Add(eSystem.ToString())
End Try


------------------------------------------------------------------------------

I've two questions:
the first is , if I open local SMTP service provided with my OS: Win 2000 professional, the code above gives me nothing, only put the mail message in the directory C:\Inetpub\mailroot\Queue, so when will it be sent out ? do i need something else to be configured ?

the second is , if I choose the outside SMTP server , assign the value to Smtpmail.Smtpserver, where can I set the authentication information ? as you know, nearly all the SMTP server now ask you to use Authentication . I cannot find the result .


whether you can give me the answer or not, I should say Thanks to everybody who take a look at this mail.

Edward , CHINA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top