03 March, 2014

How to send email in ASP.net

Please click the link and view the post new domain : http://mahedee.net instead of this. I am not updating blog here. I am writing and updating blog in http://mahedee.net

You have to configure SMTP server before sending email from your server. Hope you already know how to configure smtp server. Here is the simple code segment for sending email against a button click.

 protected void btnSendMail_Click(object sender, EventArgs e)
    {
      
        SmtpClient smtpClient = new SmtpClient(); 
        MailAddress fromAddress = new MailAddress("mahedee_hasan@leads-bd.com"); //Sender email address
        MailMessage _mail = new MailMessage();

       _mail.Attachments.Add(new Attachment(@"E:\Temp\attachment.pdf")); //Add dirctory of attachment
         
        
        //bool IsSuccess = false;
        try
        {
            _mail.From = fromAddress; 
            _mail.To.Add("mahedee.hasan@gmail.com"); //Receiver email address
            _mail.CC.Add("mahedee.hasan@yahoo.com"); //Email address for cc
            _mail.Bcc.Add("mahedee.hasan@hotmail.com"); //Email address for bcc


            _mail.Subject = "Test Message"; //Email subject
            _mail.Body = "Dear concern, This is the test message from Mahedee"; //Email body
            _mail.IsBodyHtml = true; //Email body is in html format

            smtpClient.Host = "182.268.30.50"; //Name or IP address of the host used for SMTP transaction
            smtpClient.EnableSsl = false;
            //smtpClient.Port = 25; //25 is default port for smtp. You have to change port no if it is not used defualt port 
            smtpClient.Send(_mail);   //Send mail
            //IsSuccess = true;
        }
        catch (Exception ex)
        {
            //IsSuccess = false;
        }
        finally
        {
            //
        }

    }

55 comments:

  1. Thanks for sharing such a great information..Its really nice and informative.
    Dotnet Training in Chennai

    ReplyDelete


  2. These provided information was really so nice,thanks for giving that post and the more skills to develop after refer that post.our giving articles really impressed for me,because of all information so nice.

    SAP ABAP training in Chennai

    ReplyDelete
  3. Thank you for your post. This was really an appreciating one. You done a good job. Keep on blogging like this unique information with us.

    Cloud Computing Training in Chennai

    ReplyDelete
  4. Thanks for this blog. provided great information. All the details are explained clearly with the great explanation. Thanks for this wonderful blog. Step by step processes execution are given clearly.Know the details about different thing.
    SAP Training in Chennai

    ReplyDelete
  5. I’m not sure where you’re getting your information, but good topic. I have gathered some important information from this blog.

    SEO Training in Chennai

    ReplyDelete
  6. Really, these quotes are the holistic approach towards mindfulness. In fact, all of your posts are. Proudly saying I’m getting fruitfulness out of it what you write and share. Thank you so much to both of you.

    J2ee Training in Chennai Adyar

    ReplyDelete
  7. This blog is having the general information. Got a creative work and this is very different one. We have to develop our creativity mind. This blog helps for this. Thank you for this blog. this is very interesting and useful.
    Email Marketing Chennai

    ReplyDelete
  8. thus your blog is really nice and it is very much useful and helpful i got lot of information from your blog thanks for sharing.




    Digital Marketing services in Chennai

    ReplyDelete
  9. The coded explanation of sending email in the ASP .net is clearly defined in this article. This explains the easy way to do this email process. Easily understandable one.
    Salesforce Training in Chennai

    ReplyDelete
  10. Nice..They are more informative.You have clearly explained about ASP. Thanks for sharing your time for valuable post.
    Hadoop training in Chennai

    ReplyDelete
  11. Usually I do not read post on blogs, but I would like to say that this write-up very forced me to try and do it! Your writing style has been surprised me. Great work admin..Keep update more blog..

    Online Training in Chennai

    ReplyDelete
  12. Hi, Your post is quite great to view and easy way to grab the extra knowledge. Thank you for your share with us. I like to visit your site again for my future reference.

    Seo Training in Chennai

    ReplyDelete
  13. Wow amazing i saw the article with execution models you had posted. It was such informative. Really its a wonderful article. Thank you for sharing and please keep update like this type of article because i want to learn more relevant to this topic

    SEO Training in Chennai

    ReplyDelete
  14. Your post is really great. Thank you for taking time to provide us some of the useful and exclusive information with us. Keep on blogging!!

    Seo Training in Chennai

    ReplyDelete
  15. Someone essentially lend a hand to make severely posts I would state. That is the very first time I frequented your website page and thus far? I surprised with the analysis you made to create this particular submit incredible. Fantastic job!
    Digital marketing course in Chennai

    ReplyDelete
  16. nice blog too informative. looking and reading your points its so impressive. doing more blog like this. i really appreciated doing like this.
    Java Training Institute in Chennai

    ReplyDelete

  17. Your postings are really awesome thus it is really very nice and your postures are really good thus it is very much nice and i got more information about this blog.




    Software Testing Training in Chennai

    ReplyDelete
  18. Thanks for your content. I’m going to have to bookmark it for later, because it made me think! Best wishes.if you want get certification with job in Cloud Computing please let us know by click the followig link Cloud Computing Training in Chennai

    ReplyDelete
  19. Great work yar by creating this blog and educating people like me. Keep on rocking.

    Title loans in Alabama

    ReplyDelete
  20. wow amazing post.The key points you mentioned here related to maintenance of car is really awesome.Checking all fluid levels,changing oil and of course the regular service of the car which is necessary to maintain our vehicle.Thank you for the information.

    car spa at doorstep in mumbai

    ReplyDelete
  21. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.
    Back to original

    ReplyDelete
  22. Superb. I really enjoyed very much with this article here. Really it is an amazing article I had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent article.thank you for sharing such a great blog with us. expecting for your.
    seo company in india

    ReplyDelete
  23. Wonderful bloggers like yourself who would positively reply encouraged me to be more open and engaging in commenting.So know it's helpful.
    Web Designing Training in Chennai

    ReplyDelete
  24. Thank you for sharing such a nice and interesting blog with us. I have seen that all will say the same thing repeatedly. But in your blog, I had a chance to get some useful and unique information. I would like to suggest your blog in my dude circle.
    SAS Training in Chennai

    ReplyDelete
  25. this is really too useful and have more ideas from yours. keep sharing many techniques. eagerly waiting for your new blog and useful information. keep doing more.
    SAT coaching chennai

    ReplyDelete
  26. Very nice post here and thanks for latest smartphone applications it .I always like and such a super colors of phone for these post.Excellent and very cool idea and great models and different kinds of the more information's.

    SEO Training in Chennai

    ReplyDelete


  27. Java application development

    Thanks for the awesome share
    Hi we at Colan Infotech Private Limited , a company which is Situated in US and India,
    will provide you best java web service and our talented java application development team will assure you best result
    and we are familiar with international markets,
    We work with customers in a wide variety of sectors. Our talented team can handle all the aspects of Java web application development,
    we are the best among the
    Java development company
    .

    We have quite an extensive experience working with java development services .
    we are the only Java application development company which offer custom services to a wide range of industries by
    exceeding our client’s expectations.
    You can even interact directly with the team regarding your project, just as you would with your in-house team.
    Our pro team will provide you the best java appliaction development services .
    We are best among the java development companies in Chennai ,
    please review our customer feedbacks so that you may find a clue about us. If you want one stop solution for java development outsourcing,
    Colan infotech is the only stop you need to step in.
    Colan Infotech is the unique java web development company were our team of unique
    java application developer were ranked top in java enterprise application development.

    ReplyDelete
  28. It is very useful information at my studies time, i really very impressed very well articles and worth information, i can remember more days that articles.
    Best Interior Designers in Chennai
    Interior Designers in Chennai

    ReplyDelete
  29. Wow.. Thanks much for sharing.. My friend also recommended you so that i can have a helping hand to make my blog as effective as possible.
    Tax Accountant Melbourne
    Investment Advisor Melbourne
    Mortgage Broker
    Mortgage Broker Melbourne

    ReplyDelete
  30. your post is very good & creativity you just have shared Asp.net Application Company

    ReplyDelete
  31. Interesting blog about how to send an email in aspanet which attracted me more.Spend a worthful time.keep updating more.
    Digital marketing company in Chennai

    ReplyDelete


  32. Its a wonderful post and very helpful, thanks for all this information. You are including better information regarding this topic in an effective way.Thank you so much

    Installment Loans Near Me
    Title loans Near Me
    Cash Advances Near Me

    ReplyDelete
  33. To Big Process but useful. Thanks for Sharing.
    Kvch Delhi is considered among the best 6 Weeks Java Summer Training Center In Delhi. We have 20+ years of expertise in Summer Training in Java. Due to facilitating students with affordable course fee, placement solution and world-class Android summer training to the participants.
    G-18, 2nd Floor, Preet Vihar, Delhi-110092
    Email: delhi.trg1@kvch.in
    Contact: +919212260630, +919212577708

    BEST 6 WEEKS JAVA INTERNSHIP COMPANIES IN DELHI
    BEST JAVA SIX WEEKS PROJECT BASED SUMMER TRAINING IN DELHI

    ReplyDelete
  34. Hey, Wow all the posts are very informative for the people who visit this site. Good work! We also have a Website. Please feel free to visit our site. Thank you for sharing. Well written article Thank You for Sharing with Us pmp training courses online | pmp training fee | project management training certification | project management training in chennai | project management certification online |

    ReplyDelete
  35. This comment has been removed by the author.

    ReplyDelete
  36. First this is a really Creative and Unique Article. Well, the main reason of me sharing my post here is that, We being the Digital Marketing Agencies In India are open for Partnerships with Mobile App Development, Website Development and Graphics related company !

    Get in touch with the Digital Marketing Agency In India for more information

    ReplyDelete
  37. This post is really nice and informative. The explanation given is really comprehensive and useful.

    j2ee tutorial
    advanced java course

    ReplyDelete
  38. Thanks for sharing the more valuable information with us...
    Digital Marketing in Bangalore

    ReplyDelete
  39. We are a Seo Firm Bangalore.Our Senior SEO Consultant has 10+ years experience, offers services like SEO ,PPC ,SMM ,online reputation management & web development both to small and medium companies.As a running offer,we are providing free performance audit for our customers.

    ReplyDelete
  40. Really Awe! Great And Valuable Information Provided by the blog.Very Useful and helpful. oracle training in chennai

    ReplyDelete
  41. Excellent blog with very informative information and knowledgeable Content thank you.
    typeerror nonetype object is not subscriptable

    ReplyDelete
  42. I really enjoyed reading this blog. It was explained and structured with perfection; Best Digital Marketing Company in Delhi

    ReplyDelete
  43. Awesome blog with excellent information, I really enjoyed it waiting for next blog update thank you.
    Data Science Training in Hyderabad

    ReplyDelete
  44. Amazing article with very informative information found very useful and enjoyed reading it thanks for sharing.
    Data Analytics Course Online

    ReplyDelete
  45. This comment has been removed by the author.

    ReplyDelete
  46. This is excellent information. It is amazing and wonderful to visit your site. Thanks for sharing this information, this is useful to me...

    Looking for the best PPC course in Bangalore India? Learn PPC from Ranjan Jena, 10+ Years Expert Google Ads Trainer. 1000+ Students Trained @ eMarket Education, Koramangala, Bangalore.
    Best Online Digital Marketing Courses in Bangalore
    Best Digital Marketing Institute in Bangalore

    ReplyDelete
  47. Nice post really useful information. We are the leading website development services in dubai. Hire our web design agency in dubai today for web design services in dubai

    ReplyDelete
  48. The article posted was very informative and useful. You people are doing a great job. Keep going.
    data science training

    ReplyDelete
  49. This blog was really great, never seen a great blog like this before. i think im gonna share this to my friends..
    data science course in hyderabad

    ReplyDelete
  50. This is awesome explanation, good post.

    ReplyDelete