Professional Web Applications Themes

Sending mail. - ASP.NET General

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

  1. #1

    Default 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.



    Phoebe. Guest

  2. #2

    Default Re: Sending mail.

    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" <SteveOrr.net> wrote in message
    news:OkBc0vbUDHA.1280tk2msftngp13.phx.gbl...
    > One approach would be to put your email code in the Application_OnError
    > event.
    > Here's more info:
    > [url]http://www.ragingsmurf.com/code.aspx?key=K62OO6HIDR[/url]
    > [url]http://www.15seconds.com/issue/030102.htm[/url]
    >
    > --
    > I hope this helps,
    > Steve C. Orr, MCSD
    > [url]http://Steve.Orr.net[/url]
    >
    >
    > "Phoebe." <phoebe8124hotmail.com> wrote in message
    > news:%23%23Ko9UbUDHA.1680tk2msftngp13.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.
    > >
    > >
    > >
    >
    >

    Phoebe. Guest

  3. #3

    Default Re: Sending mail.

    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
    [url]http://Steve.Orr.net[/url]


    "Phoebe." <phoebe8124hotmail.com> wrote in message
    news:eDVzm7bUDHA.212TK2MSFTNGP12.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" <SteveOrr.net> wrote in message
    > news:OkBc0vbUDHA.1280tk2msftngp13.phx.gbl...
    > > One approach would be to put your email code in the Application_OnError
    > > event.
    > > Here's more info:
    > > [url]http://www.ragingsmurf.com/code.aspx?key=K62OO6HIDR[/url]
    > > [url]http://www.15seconds.com/issue/030102.htm[/url]
    > >
    > > --
    > > I hope this helps,
    > > Steve C. Orr, MCSD
    > > [url]http://Steve.Orr.net[/url]
    > >
    > >
    > > "Phoebe." <phoebe8124hotmail.com> wrote in message
    > > news:%23%23Ko9UbUDHA.1680tk2msftngp13.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.
    > > >
    > > >
    > > >
    > >
    > >
    >
    >

    Steve C. Orr, MCSD Guest

  4. #4

    Default Re: Sending mail.

    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" <SteveOrr.net> wrote in message news:eErLPiiUDHA.1052TK2MSFTNGP09.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
    > [url]http://Steve.Orr.net[/url]
    >
    >
    > "Phoebe." <phoebe8124hotmail.com> wrote in message
    > news:eDVzm7bUDHA.212TK2MSFTNGP12.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" <SteveOrr.net> wrote in message
    > > news:OkBc0vbUDHA.1280tk2msftngp13.phx.gbl...
    > > > One approach would be to put your email code in the Application_OnError
    > > > event.
    > > > Here's more info:
    > > > [url]http://www.ragingsmurf.com/code.aspx?key=K62OO6HIDR[/url]
    > > > [url]http://www.15seconds.com/issue/030102.htm[/url]
    > > >
    > > > --
    > > > I hope this helps,
    > > > Steve C. Orr, MCSD
    > > > [url]http://Steve.Orr.net[/url]
    > > >
    > > >
    > > > "Phoebe." <phoebe8124hotmail.com> wrote in message
    > > > news:%23%23Ko9UbUDHA.1680tk2msftngp13.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.
    > > > >
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    >
    >
    Rajeev Soni Guest

Similar Threads

  1. Sending e-mail via PHP
    By Domin in forum PHP Development
    Replies: 4
    Last Post: November 29th, 01:59 PM
  2. sending mail without the mail client popping up
    By Obscurr in forum PHP Development
    Replies: 2
    Last Post: October 31st, 01:52 PM
  3. #25357 [Com]: Mail() function is loosing cahracters when sending mail
    By dj_canard at yahoo dot com in forum PHP Development
    Replies: 0
    Last Post: September 24th, 02:10 PM
  4. #25357 [NEW]: Mail() function is loosing cahracters when sending mail
    By pjsmith at microtech dot co dot gg in forum PHP Development
    Replies: 0
    Last Post: September 2nd, 11:32 AM
  5. Sending Mail
    By - Steve - in forum ASP
    Replies: 5
    Last Post: August 14th, 06:29 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139