email

Discussion in 'ASP .Net Web Services' started by Jaez, Feb 17, 2007.

  1. Jaez

    Jaez Guest

    I am new to asp.net 2 and am struggling with emailing to a list of
    addresses

    I can send emails OK using:

    Dim MailObj As New System.Net.Mail.SmtpClient
    MailObj.Send(EmFrom.Text, EmTo.Text, EmSubj.Text, EmMsg.Text)

    but I seem to be unable to detect if an email fails to send ie if the
    address has a typo or the address is not able to receive an email

    in php I might write something like:

    if (mail($to, $subject, $body)) { echo("<p>Message successfully
    sent!</p>"); } else { echo("<p>Message delivery failed...</p>"); }

    so is thier an equivalent structure in asp.net 2

    Thanks

    jaez
    Jaez, Feb 17, 2007
    #1
    1. Advertising

  2. all you have to do is you try/catch

    try
    Dim MailObj As New System.Net.Mail.SmtpClient
    MailObj.Send(EmFrom.Text, EmTo.Text, EmSubj.Text, EmMsg.Text)
    Catch ex as Exception
    response.write("<p>Message delivery failed...</p>")
    response.flush()
    End Catch

    and please... dont mention PHP! that it's not even a programing language !
    it's a scripting language live Javascript is...



    "Jaez" <> wrote in message
    news:MMyBh.18357$...
    >I am new to asp.net 2 and am struggling with emailing to a list of
    >addresses
    >
    > I can send emails OK using:
    >
    > Dim MailObj As New System.Net.Mail.SmtpClient
    > MailObj.Send(EmFrom.Text, EmTo.Text, EmSubj.Text, EmMsg.Text)
    >
    > but I seem to be unable to detect if an email fails to send ie if the
    > address has a typo or the address is not able to receive an email
    >
    > in php I might write something like:
    >
    > if (mail($to, $subject, $body)) { echo("<p>Message successfully
    > sent!</p>"); } else { echo("<p>Message delivery failed...</p>"); }
    >
    > so is thier an equivalent structure in asp.net 2
    >
    > Thanks
    >
    > jaez
    >
    Bruno Alexandre, Feb 17, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter
    Replies:
    0
    Views:
    3,351
    Peter
    Jul 1, 2003
  2. John Silver
    Replies:
    0
    Views:
    606
    John Silver
    Feb 4, 2005
  3. Tee

    Email ErrorPage to email

    Tee, Jun 23, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    376
  4. Replies:
    3
    Views:
    529
    AdamM
    Jul 27, 2004
  5. Chuck Amadi
    Replies:
    2
    Views:
    397
    chuck amadi
    Jun 6, 2004
Loading...

Share This Page