By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,117 Members | 2,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,117 IT Pros & Developers. It's quick & easy.

Questions about SmtpMail class of ASP.NET

P: n/a
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





Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Quoted for a search to
Goggle(http://www.sitepoint.com/forums/show....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 = "bo**@addr.net"
Msg.From = "bo**@addr.net"
Msg.Subject = "Subject"
Msg.BodyFormat = Mail.MailFormat.Html
Msg.Body = "Message"

System.Web.Mail.SmtpMail.SmtpServer = "remoteserver"
System.Web.Mail.SmtpMail.Send(Msg)
"Edward" <zi***@citiz.net> ] news:ep**************@TK2MSFTNGP10.phx.gbl
׫...
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
Nov 18 '05 #2

P: n/a
http://www.systemwebmail.com/

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

"Edward" <zi***@citiz.net> wrote in message news:ep**************@TK2MSFTNGP10.phx.gbl...
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





Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.