473,408 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Sending an email from ASP.Net using VB

Hi all,

I'm using the following code:
Nov 18 '05 #1
4 1129
....and hating the ctrl-enter key combination - my appologies - I'll try
again...

I am using the following code:

' Send email
Dim objEmail As New MailMessage
objEmail.To = "me@mydomain.com"
objEmail.From = "en*******@mydomain.com"
objEmail.Subject = "Enquiry"
objEmail.Body = strEmailBody
objEmail.Priority = MailPriority.High
SmtpMail.SmtpServer = "localhost"

Try
SmtpMail.Send(objEmail)
panelContactUsForm.Visible = False
panelContactUsThanks.Visible = True
panelContactUsError.Visible = False
Catch exc As Exception
Response.Write("Send failure: " + exc.ToString())
panelContactUsForm.Visible = False
panelContactUsThanks.Visible = False
panelContactUsError.Visible = True
End Try

This is working fine and I am receiving emails nicely on my development
server here. What I've found odd is that I can't seem to prevent an email
coming through! I shall explain..

I looked in IIS but found no "Default SMTP Server" like I used to on Windows
2000 (now using Windows 2003) - I believe this gets added to the ISM when
you set the role as a Mail Server, however, enough components from the CD
have been installed to enable email quite obviously. So, I figured the best
way to stop the service was to go into Services, find the Simple Mail
Transfer Protocol service and stop it - I did this, I waited a bit and then
tried my application again - I received an email!

So, kinda confused now - I want to test that my exception handling works, I
can obviously knock out the objEmail.To = line and change it to something
daft, which might work, but I dont understand why I'm getting emails when as
far as I can see I shouldn't be...

Any information would be appreciated,

Regards

Rob Meade
I
Nov 18 '05 #2
Ok - I installed MailEnable (www.mailenable.com) a few weeks back, forgot it
was running, it would seem that my server had a choice of SMTP services to
use, couldn't perhaps use the normal one so used MailEnable instead...I
stopped ALL of those services, and the SMTP one and got the expected error
message...

Sorry to bother...

Regards

Rob
Nov 18 '05 #3
Just sitting here enjoying your conversation with yourself! <grin>

"Rob Meade" <ro********@NO-SPAM.kingswoodweb.net> wrote in message
news:0v*******************@news-text.cableinet.net...
Ok - I installed MailEnable (www.mailenable.com) a few weeks back, forgot
it
was running, it would seem that my server had a choice of SMTP services to
use, couldn't perhaps use the normal one so used MailEnable instead...I
stopped ALL of those services, and the SMTP one and got the expected error
message...

Sorry to bother...

Regards

Rob


Nov 18 '05 #4
"Ken Cox [Microsoft MVP]" wrote ...
Just sitting here enjoying your conversation with yourself! <grin>


hehe, always happy to entertain :o)

Regards

Rob
Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: joe215 | last post by:
I want my users to send emails from a Windows app that I am developing in Visual Basic.NET 2003. I found a good example of sending email to a SMTP server using the SmtpMail class. However, using...
2
by: kimberly.shaffer | last post by:
Okay, I can automate sending of multiple emails with records using Groupwise and Access DB. But now what I need to do is send multiple fields associated with one field out automatically and can't...
17
by: Bonj | last post by:
Right guys. (I would like a solution to this in VB6 as this is what our needy app is written in, but any solutions that involve .NET would be much appreciated likewise as I could instantiate...
9
by: B-Dog | last post by:
I've built a small app that sends mail through our ISP's SMTP server but when I try to send through my local exchange server I get CDO error. Does webmail use SMTP or does it strictly rely on...
3
by: Ant | last post by:
Hi, I'm using the MailMessage & smtpMail classes in System.Web.Mail to send mail, however it's not sending any emails. I'm using it on a Windows 2003 server. The simplest way to use this is...
6
by: Anuradha | last post by:
Dear All How can i send mails using vb.net Thanx all
1
by: Eric Sheu | last post by:
Greetings, I have been searching the web like mad for a solution to my SMTP problem. I am using Windows Server 2003 and ASP.NET 2.0 w/ C# to send out e-mails from a web site I have created to...
4
by: Roger Withnell | last post by:
I'm sending Russian text in an email generated from the website which displays in the email as ?????????? The website is set to codepage 65001 and the charset to utf-8. Please advise. ...
7
by: undbund | last post by:
Hi I am creating a newsletter system. The software should run from desktop computer (localhost) but be able to send email to anyone on the internet. Can you guys give me some ideas on how to...
10
by: Markgoldin | last post by:
I am sending an XML data from not dontnet process to a .Net via socket listener. Here is a data sample: <VFPData> <serverdata> <coderun>updateFloor</coderun> <area>MD2</area>...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...
0
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.