473,398 Members | 2,404 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,398 software developers and data experts.

Sending mail.

Hi, Good Day!

I am writing a code in order to send a mail out when certain job failed
while running the program. Meanwhile for my testing, I'm either hardcoding
the address or type in on the spot so that the mail will be send as expected
to certain people. The code is as below.
Sub SubmitBtn_Click(ByVal sender As Object, ByVal e As EventArgs)

Dim TheMailMessage As New Mail.MailMessage()

Dim TheMailConnection As SmtpMail

TheMailMessage.From = txtFromEmail.Text

TheMailMessage.To = txtToEmail.Text

TheMailMessage.Subject = txtSubject.Text

TheMailMessage.Body = txtMessage.Text

TheMailConnection.Send(TheMailMessage)

End Sub

What I need is to send the mail automatically when the program facing
error. How shd I do? Can someone help?

Thanks in advanced.

rgds, Phoebe.

Nov 17 '05 #1
3 1468
Thanks Steve.

My main concern is to send out mail without hardcode those emailTo,
emailFrom address. Can i save these email address in a file, maybe like
notepad or something else.

Thanks in advanced.

rgds,
Phoebe.

"Steve C. Orr, MCSD" <St***@Orr.net> wrote in message
news:Ok**************@tk2msftngp13.phx.gbl...
One approach would be to put your email code in the Application_OnError
event.
Here's more info:
http://www.ragingsmurf.com/code.aspx?key=K62OO6HIDR
http://www.15seconds.com/issue/030102.htm

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
"Phoebe." <ph********@hotmail.com> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
Hi, Good Day!

I am writing a code in order to send a mail out when certain job failed
while running the program. Meanwhile for my testing, I'm either hardcoding the address or type in on the spot so that the mail will be send as

expected
to certain people. The code is as below.
Sub SubmitBtn_Click(ByVal sender As Object, ByVal e As EventArgs)

Dim TheMailMessage As New Mail.MailMessage()

Dim TheMailConnection As SmtpMail

TheMailMessage.From = txtFromEmail.Text

TheMailMessage.To = txtToEmail.Text

TheMailMessage.Subject = txtSubject.Text

TheMailMessage.Body = txtMessage.Text

TheMailConnection.Send(TheMailMessage)

End Sub

What I need is to send the mail automatically when the program facing
error. How shd I do? Can someone help?

Thanks in advanced.

rgds, Phoebe.


Nov 17 '05 #2
There are lots of places you could store that information, but I can't tell
you which is best since I don't know the details of your app.
Off the top of my head I'd think some likely places would be Session,
Application, Cache, a database, a text or xml file, etc.

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
"Phoebe." <ph********@hotmail.com> wrote in message
news:eD*************@TK2MSFTNGP12.phx.gbl...
Thanks Steve.

My main concern is to send out mail without hardcode those emailTo,
emailFrom address. Can i save these email address in a file, maybe like
notepad or something else.

Thanks in advanced.

rgds,
Phoebe.

"Steve C. Orr, MCSD" <St***@Orr.net> wrote in message
news:Ok**************@tk2msftngp13.phx.gbl...
One approach would be to put your email code in the Application_OnError
event.
Here's more info:
http://www.ragingsmurf.com/code.aspx?key=K62OO6HIDR
http://www.15seconds.com/issue/030102.htm

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
"Phoebe." <ph********@hotmail.com> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
Hi, Good Day!

I am writing a code in order to send a mail out when certain job failed while running the program. Meanwhile for my testing, I'm either hardcoding the address or type in on the spot so that the mail will be send as

expected
to certain people. The code is as below.
Sub SubmitBtn_Click(ByVal sender As Object, ByVal e As EventArgs)

Dim TheMailMessage As New Mail.MailMessage()

Dim TheMailConnection As SmtpMail

TheMailMessage.From = txtFromEmail.Text

TheMailMessage.To = txtToEmail.Text

TheMailMessage.Subject = txtSubject.Text

TheMailMessage.Body = txtMessage.Text

TheMailConnection.Send(TheMailMessage)

End Sub

What I need is to send the mail automatically when the program facing
error. How shd I do? Can someone help?

Thanks in advanced.

rgds, Phoebe.



Nov 17 '05 #3
Keep your Email Id's in Web.Config file.
define keys for each EmailTO, email from......

you have amny options after that, either read the email-id's when ever u require to send mails or on the application start event read the Email-Ids/Setting from the Web.Config file and load it into Application object/Cahce object but not session... as session is user specific.

hope it helps
Rajeev
"Steve C. Orr, MCSD" <St***@Orr.net> wrote in message news:eE**************@TK2MSFTNGP09.phx.gbl...
There are lots of places you could store that information, but I can't tell
you which is best since I don't know the details of your app.
Off the top of my head I'd think some likely places would be Session,
Application, Cache, a database, a text or xml file, etc.

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net


"Phoebe." <ph********@hotmail.com> wrote in message
news:eD*************@TK2MSFTNGP12.phx.gbl...
Thanks Steve.

My main concern is to send out mail without hardcode those emailTo,
emailFrom address. Can i save these email address in a file, maybe like
notepad or something else.

Thanks in advanced.

rgds,
Phoebe.

"Steve C. Orr, MCSD" <St***@Orr.net> wrote in message
news:Ok**************@tk2msftngp13.phx.gbl...
One approach would be to put your email code in the Application_OnError
event.
Here's more info:
http://www.ragingsmurf.com/code.aspx?key=K62OO6HIDR
http://www.15seconds.com/issue/030102.htm

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
"Phoebe." <ph********@hotmail.com> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
> Hi, Good Day!
>
> I am writing a code in order to send a mail out when certain job failed > while running the program. Meanwhile for my testing, I'm either

hardcoding
> the address or type in on the spot so that the mail will be send as
expected
> to certain people. The code is as below.
> Sub SubmitBtn_Click(ByVal sender As Object, ByVal e As EventArgs)
>
> Dim TheMailMessage As New Mail.MailMessage()
>
> Dim TheMailConnection As SmtpMail
>
> TheMailMessage.From = txtFromEmail.Text
>
> TheMailMessage.To = txtToEmail.Text
>
> TheMailMessage.Subject = txtSubject.Text
>
> TheMailMessage.Body = txtMessage.Text
>
> TheMailConnection.Send(TheMailMessage)
>
> End Sub
>
> What I need is to send the mail automatically when the program facing
> error. How shd I do? Can someone help?
>
> Thanks in advanced.
>
> rgds, Phoebe.
>
>
>



Nov 17 '05 #4

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

Similar topics

0
by: praba kar | last post by:
Dear All, I have doubt regarding mail sending smtplib module. The below code is I used to send a mail. ########################################## import email.Message import email.Utils...
10
by: Stuart Mueller | last post by:
I have an exchange server, that I sometimes use to perform mail shots to clients on our database, these can be upwards of 1000 at a time. As we don't want different clients to see who we are...
2
by: Mr. x | last post by:
Hello, I am sending emails with Hebrew contents. When receiving emails - I cannot see the Hebrew characters (it is not outlook express configuration, because when receiving emails from friends -...
3
by: VB Programmer | last post by:
I have an ASPX page where I send out emails through my mail server mail.MyDomain.com. When I send emails to MyName@MyDomain.com it sends PERFECTLY. When I try sending an email to any other address...
3
by: HoustonComputerGuy | last post by:
I am working on getting my web applications moved to .Net 2.0 and am having some problems with System.Net.Mail. I get the following error when sending the mail: System.Net.Mail.SmtpException was...
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...
2
by: HK | last post by:
In VB.NET, I'm getting the exception "failure sending mail". I'm running VS 2005 on XP Home. This is a new install on a new PC. I've never had email problems with VS 2003, and there I could...
3
by: mfleet1973 | last post by:
Hello Again. I have a program that sends e-mails as follows: Try Dim mail As New MailMessage mail.To = "me@comp.com" mail.From = "me@comp.com mail.Subject = "Test" mail.Body = "Testing123"
9
by: JoeP | last post by:
Hi All, How can I find the reason for such an error: Failure sending mail. Some Code... oMailMessage.IsBodyHtml = False oMailMessage.Body = cEmailBody Dim oSMTP As New SmtpClient...
4
by: =?Utf-8?B?R3V5IENvaGVu?= | last post by:
Hi all I use: Dim message As New MailMessage(txtTo.Text, txtFrom.Text, txtSubject.Text, txtBody.Text) Dim emailClient As New SmtpClient(txtSMTPServer.Text) emailClient.Send(message) And its...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
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
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...

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.