What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 11982 |  Welcome, Guest!   Register  Login
 Home > Forums > ASP.NET > How i can display the message based on the Mail Sending ...
Kondapallisrinivas

How i can display the message based on the Mail Sending

Replies: 2 | Posted by: Kondapallisrinivas on 10/9/2012 | Category: ASP.NET Forums | Views: 229 | Status: [Member] | Points: 10  


Hello All

I add mail sending feature for my project by taking help from the article(http://www.dotnetfunda.com/articles/article747-how-to-send-an-e-mail-using-gmail-in-aspnet.aspx )...As of now every thing is okay.

But now i am trying if the message has been sucessfully sent then i want to dispaly the label text as Message sent sucessfully. And if it fails then it has to be display as message sending failed.

So please suggest how i can achive this

Thanks in advance

Regards
Kondapalli Srinivas


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Samanthajyesta
Samanthajyesta  
Posted on: 10/19/2012 1:50:40 AM
Level: Starter | Status: [Member] | Points: 25

Hi,
Simply keep a label under send button with the message sent text and add this code in try block ,after send mail code.

Regards,
Sam

http://www.dotnetfunda.com

Kondapallisrinivas, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Vasanthmvp
Vasanthmvp  
Posted on: 10/19/2012 2:32:55 AM
Level: Starter | Status: [Member] | Points: 25

Hi,
Send() method is of void return type. so we can't get a value based on which we would acknowledge whether a mail has been successfully sent or not.
One way to do this is, include the mail sending part in try block..
If any exception raises.. display sending failed message. Not only one exception that may raise like
1. Mail ID doesn't exists
2. Network Failure / Error
3. If user sending large size files, it takes time.. during which a user may refresh or perform any other event.
Hence, its good to include it in a catch block itself.

If i am wrong, plz correct me.
Regards,

Awesome Coding !! :)

Kondapallisrinivas, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/21/2013 4:58:39 PM