473,569 Members | 2,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.SmtpS erver = "smtp.citiz.net "
SmtpMail.Send(m sg)
Catch ehttp As System.Web.Http Exception
lstError.Items. Add(ehttp.Messa ge)
lstError.Items. Add("Here is the full error message")
lstError.Items. Add(ehttp.ToStr ing())
txtError.Text = "["+SmtpMail.Smtp Server + "]" + ehttp.ToString( )
End Try
Catch eSystem As System.Exceptio n
' 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.ToS tring())
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\mail root\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.Smtpse rver, 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 1795
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("htt p://schemas.microso ft.com/cdo/configuration/smtsperver") =
"remoteserv er"
Msg.Fields("htt p://schemas.microso ft.com/cdo/configuration/smtpserverport" )
= 25
Msg.Fields("htt p://schemas.microso ft.com/cdo/configuration/sendusing") = 2
Msg.Fields("htt p://schemas.microso ft.com/cdo/configuration/smtpauthenticat e"
) = 1
Msg.Fields("htt p://schemas.microso ft.com/cdo/configuration/sendusername") =
"username"
Msg.Fields("htt p://schemas.microso ft.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.SmtpS erver = "remoteserv er"
System.Web.Mail .SmtpMail.Send( Msg)
"Edward" <zi***@citiz.ne t> ÔÚà]¼þ news:ep******** ******@TK2MSFTN GP10.phx.gbl
ÖÐ׫Œ‘...
Hello, everybody,

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


Try
Try
'SmtpMail.SmtpS erver = "smtp.citiz.net "
SmtpMail.Send(m sg)
Catch ehttp As System.Web.Http Exception
lstError.Items. Add(ehttp.Messa ge)
lstError.Items. Add("Here is the full error message")
lstError.Items. Add(ehttp.ToStr ing())
txtError.Text = "["+SmtpMail.Smtp Server + "]" + ehttp.ToString( )
End Try
Catch eSystem As System.Exceptio n
' 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.ToS tring())
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\mail root\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.Smtpse rver, 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.ne t> wrote in message news:ep******** ******@TK2MSFTN GP10.phx.gbl...
Hello, everybody,

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

------------------------------------------------------------------------------
Try
Try
'SmtpMail.SmtpS erver = "smtp.citiz.net "
SmtpMail.Send(m sg)
Catch ehttp As System.Web.Http Exception
lstError.Items. Add(ehttp.Messa ge)
lstError.Items. Add("Here is the full error message")
lstError.Items. Add(ehttp.ToStr ing())
txtError.Text = "["+SmtpMail.Smtp Server + "]" + ehttp.ToString( )
End Try
Catch eSystem As System.Exceptio n
' 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.ToS tring())
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\mail root\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.Smtpse rver, 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
3802
by: Jason | last post by:
Hi just a really quick simple question. Can you configure SmtpMail class in C# to use a different port? or does it have to be port 25? Thanks Jason
3
2693
by: Renato Giron | last post by:
I am trying to use an aspx page to send email using the smtpMail class and my smtp server . When I click send but when I check my inbox no messages appear. The page doesn't give any errors. I doble checked and my code behing seems find: Dim objmail As New Web.Mail.MailMessage() objmail.From = "renato@myserver.com" objmail.To =...
2
2536
by: Leszek | last post by:
Hello, I have created a simple code to send emails using the MailMessage class and the SmtpMail.Send() method: MailMessage mail = new MailMessage(); mail.From = echidna@somewhere.com; // hard-coded mail.To = platypus@somewhere.com; mail.Subject = "Test"; mail.Body = strMessage;
5
2136
by: ElanKathir | last post by:
Hi ! I wrote one code for Send the E-mail, But that code have some problem , So please help me Here i paste my code and Error: Error: Server Error in '/Elan_Sample' Application. --------------------------------------------------------------------------------
3
3493
by: chuckdfoster | last post by:
When using this bit of code, it sends two emails most of the time. Sometimes it doesn't send two, but most of the time it does. I put the system time (Now) in the Subject and each email has a different time by a minute or so. I also tried to count the number of emails it is sending by using the intEmail = intEmail + 1, but the number is...
3
1559
by: aslantifosi | last post by:
hi all, My question is about that i use a smpt server which is running on a different machine from my webserver machine. And i can authenticate with a user and password. I use SmtpMail class. i set the smtpserver property. but how can i authenticate with my user and pass? for ex: my user :xxxx@xxx.com pass :12345
19
3356
by: zdrakec | last post by:
Hello all: Using an "Imports System.Web.Mail" clause at the head of my module, and after executing the following code: Dim msg As New MailMessage msg.From = sender msg.To = recipient msg.Attachments.Add(New MailAttachment(attachFile)) msg.Subject = subjectString
3
1814
by: Nathan Sokalski | last post by:
I have an ASP.NET page that sends a Mail.MailMessage to several email addresses (all mine). However, one of the addresses, the one ending in @verizon.net, does not seem to be recieving the message even though the other addresses are. I know the spelling is correct because I have tried sending messages from my other accounts to this address and...
5
1876
by: senol | last post by:
UPLOAD bu class public static void ResimYükle(HtmlInputFile HtmlInput, string id,string Klasor,string KatID) { string path_file;
0
8122
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7673
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7970
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1213
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.