Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > email

Reply
Thread Tools

email

 
 
Jaez
Guest
Posts: n/a
 
      02-17-2007
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


 
Reply With Quote
 
 
 
 
Bruno Alexandre
Guest
Posts: n/a
 
      02-17-2007
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" <(E-Mail Removed)> wrote in message
news:MMyBh.18357$(E-Mail Removed)...
>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
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mozilla Thunderbird Email NOT capturing clicked email links... AJPDLA Firefox 4 04-12-2006 07:05 PM
Email server timing out in email script John Silver Perl 0 02-04-2005 07:47 AM
page to image image to email email to fax jason@cyberpine.com ASP .Net 3 07-27-2004 09:51 PM
Email ErrorPage to email Tee ASP .Net 0 06-23-2004 07:44 PM
HowTo:? open email client to send email Peter ASP .Net 0 07-01-2003 04:58 PM



Advertisments