473,890 Members | 2,051 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 1808
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
3821
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
2707
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 = "renato@myserver.com"
2
2560
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
2157
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
3504
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 always 1.Could anyone tell me why this is happening or give me advice on how to change it. Thanks...
3
1568
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
3385
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
1840
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 have recieved them successfully. I also do not know of any junkmail filter that would delete the...
5
1888
by: senol | last post by:
UPLOAD bu class public static void ResimYkle(HtmlInputFile HtmlInput, string id,string Klasor,string KatID) { string path_file;
0
9812
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11212
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10799
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10446
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8004
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6032
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4655
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
2
4255
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3263
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.