469,317 Members | 1,957 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,317 developers. It's quick & easy.

Questions about SmtpMail class of ASP.NET

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
2 1647
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
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.

Similar topics

7 posts views Thread by Jason | last post: by
3 posts views Thread by Renato Giron | last post: by
2 posts views Thread by Leszek | last post: by
5 posts views Thread by ElanKathir | last post: by
3 posts views Thread by chuckdfoster | last post: by
3 posts views Thread by aslantifosi | last post: by
3 posts views Thread by Nathan Sokalski | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.