Ask a Question related to ASP.NET General, Design and Development.

  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. Similar Questions and Discussions

    1. sending mail without the mail client popping up
      hi! I was wondering how I could send a mail without the mail client popping up to the user. I would like a mail to be sent to myself when...
    2. #25357 [Com]: Mail() function is loosing cahracters when sending mail
      ID: 25357 Comment by: dj_canard at yahoo dot com Reported By: pjsmith at microtech dot co dot gg Status: Bogus...
    3. #25357 [NEW]: Mail() function is loosing cahracters when sending mail
      From: pjsmith at microtech dot co dot gg Operating system: Windows 2003, IIS, ISAPI PHP version: 4.3.3 PHP Bug Type: *Mail...
    4. sending mail with PWS
      Hi all, i use a personal web server and i'd like to send a mail into an ASP page. Usually, i use CDONT component but it seems it does not work on...
    5. Sending Mail
      Shouldn't this code do it on a Win2k3 box. Set oMsg = Server.CreateObject("CDO.Message") oMsg.From = "address@domain.com" oMsg.To =...
  3. #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" <Steve@Orr.net> wrote in message
    news:OkBc0vbUDHA.1280@tk2msftngp13.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." <phoebe8124@hotmail.com> wrote in message
    > news:%23%23Ko9UbUDHA.1680@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.
    > >
    > >
    > >
    >
    >

    Phoebe. Guest

  4. #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." <phoebe8124@hotmail.com> wrote in message
    news:eDVzm7bUDHA.212@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" <Steve@Orr.net> wrote in message
    > news:OkBc0vbUDHA.1280@tk2msftngp13.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." <phoebe8124@hotmail.com> wrote in message
    > > news:%23%23Ko9UbUDHA.1680@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.
    > > >
    > > >
    > > >
    > >
    > >
    >
    >

    Steve C. Orr, MCSD Guest

  5. #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" <Steve@Orr.net> wrote in message news:eErLPiiUDHA.1052@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
    > [url]http://Steve.Orr.net[/url]
    >
    >
    > "Phoebe." <phoebe8124@hotmail.com> wrote in message
    > news:eDVzm7bUDHA.212@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" <Steve@Orr.net> wrote in message
    > > news:OkBc0vbUDHA.1280@tk2msftngp13.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." <phoebe8124@hotmail.com> wrote in message
    > > > news:%23%23Ko9UbUDHA.1680@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.
    > > > >
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    >
    >
    Rajeev Soni Guest

Posting Permissions

  • You may not post new threads
  • You may 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