Part 43- How to Send Email in ASP.NET MVC | Step-by-Step guide for Beginners and Professionals

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ก.พ. 2025
  • OVERVIEW:
    In this video I have explained, how to implement an email functionality in asp.net MVC. So its good to learn email sending from scratch. This video is for beginners as well as for professionals.
    SOCIAL :
    Like TechnoTips official Page : / technotipstutorial
    Subscribe on TH-cam: / aapkanigam
    Follow us on Twitter : @technotipsMVC, @aapkanigam
    VISIT BLOG HERE :
    technotipstutor...
    INTRODUCTION :
    Now a days, sending email is common in all websites as it will help admin or user to exchange information and maintain security.
    Many website sends OTP password through email facility in oder to verify user identity.
    So here in this tutorial I have implemented email functionality from the scratch.
    1. Create smtp object
    2. Set host as smtp.gmail.com and port as 587
    3.Set timeout as 100000 , EnableSsl as true, default credential as false
    4. Create MailMessage object and pass sender email ,receiver email, subject and body into this. Then pass this class to Send method of smtp client.
    5. Finally use Send method to send mesage
    RECOMMENDATION:
    1.Upload image to file server
    • Part 33- Upload and di...
    TAGS :
    How to send email in Asp.net mvc
    step by step guide for beginners
    Email functionality in mvc step-by-step
    JQuery-UI Autocomplete Textbox
    how to Implement Jquery Autocomplete Textbox with data from Server
    C# send email
    how to create responsive sortable photo gallery
    c# send html email
    download image from url and save to SQL
    upload and show image in asp.net mvc
    create dynamic menu in asp.net mvc
    return multiple model
    create login page in asp.net
    login page bootstrap
    create registration form in asp.net mvc
    create registration page
    Partial view in mvc
    how to create a - website
    how to create bootstrap popup modal
    asp. net mvc
    asp.net mvc 5 tutorial
    model view controller
    jquery-ajax Post
    best video in mvc
    top mvc tutorial

ความคิดเห็น • 64

  • @aapkanigam
    @aapkanigam  7 ปีที่แล้ว +5

    Can we reach 1000 likes on this video. Share this video among your friends and Give your suggestions on which topic I should make videos. Thanks

    • @zeeshanahmadkhalil8920
      @zeeshanahmadkhalil8920 4 ปีที่แล้ว +1

      Exception:the remote certificate is invalid according to the validation procedure.

    • @zeeshanahmadkhalil8920
      @zeeshanahmadkhalil8920 4 ปีที่แล้ว +1

      Thanks! I made it working by disabling the security by calling the following function before `pclient.Send()` and it worked;
      static void NEVER_EAT_POISON_Disable_CertificateValidation()
      {
      // Disabling certificate validation can expose you to a man-in-the-middle attack
      // which may allow your encrypted message to be read by an attacker
      // stackoverflow.com/a/14907718/740639
      ServicePointManager.ServerCertificateValidationCallback =
      delegate (
      object s,
      X509Certificate certificate,
      X509Chain chain,
      SslPolicyErrors sslPolicyErrors
      ) {
      return true;
      };
      }
      But we should disable security only if we are not doing any production work.

  • @lutforurc
    @lutforurc 7 ปีที่แล้ว

    Nice video ‍and Thank you very much for giving 4 videos this week.

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว

      +Lutfor Rahman thanks ..its 5th one

    • @lutforurc
      @lutforurc 7 ปีที่แล้ว

      Thank you sir.
      You can use "minLength" to reduce pressure on database.

  • @rakshithashettigar9160
    @rakshithashettigar9160 4 หลายเดือนก่อน

    I am creating an application where I need to send notification the user who have registered in my application about the activities that will happen, and will send emails to their outlook regarding the activities in the application, I cannot use their personal Outlook account password right?? I will have a password when they registered to my application, Can I use that Password and their outlook Mail ID to send emails..?

  • @lucascamino8615
    @lucascamino8615 7 ปีที่แล้ว

    Hi! It seems everything is working well in the video. Tomorrow I'll be implementing this and I'll let you know if I have any problem! Thanks for your help

  • @zahidulemon5058
    @zahidulemon5058 7 ปีที่แล้ว

    thank u bro for publishing new tutorial ..I m desperately waiting for your new video ....hope more will come

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว

      +Zahidul Emon sure..thanks.. keep learning and sharing

  • @rabiasardar6668
    @rabiasardar6668 5 ปีที่แล้ว

    when user click on send email ,it should send an autogenerated OTP to the user ?help me out

  • @mehmetkadirkuzucu4394
    @mehmetkadirkuzucu4394 5 ปีที่แล้ว

    Excellent work bro, you saved me ....

    • @aapkanigam
      @aapkanigam  5 ปีที่แล้ว

      Thanks!! Keep learning and sharing 🙏

  • @astiginko
    @astiginko 3 ปีที่แล้ว

    Can we send message in different email of the user?

  • @sworld6589
    @sworld6589 6 ปีที่แล้ว +2

    Hello sir, can u share me email template and notification template using Web api with mvc, actually it's my functionality & I am facing many problems, for the same I saw your videos but there I couldn't see.. Plz help me if possible

  • @d.choudhary2705
    @d.choudhary2705 7 ปีที่แล้ว

    request you to please show in demo how to create project layered architecture in MVC in real time sceniro. good job bro. carry on, God bless u.

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว +1

      +Dinesh Kumar thanks .. keep learning and sharing

  • @s.k3518
    @s.k3518 6 ปีที่แล้ว +1

    Dear Sir
    Please help me out to develop such kind of enquiry page in MVC when user click on submit button then all parameters value should come to email..
    Regards
    Satendra

  • @sajidkhan763
    @sajidkhan763 7 ปีที่แล้ว

    Thanks, Ashish love your way of teaching,

  • @naderladhari9772
    @naderladhari9772 6 ปีที่แล้ว

    Hi , thank you for this video , but i wanted to ask if the ToEmail that we will send an email to have to be taken from a database how we do that?

  • @nguyennga6099
    @nguyennga6099 4 ปีที่แล้ว

    thanks so much

  • @harisnadeem1318
    @harisnadeem1318 6 ปีที่แล้ว

    Amazing work bro.

  • @Adityasharma-oe8zp
    @Adityasharma-oe8zp ปีที่แล้ว

    from where do i get user email and password

  • @SY-uh8vs
    @SY-uh8vs 5 ปีที่แล้ว

    Hi I get this error: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at. did you do any smtp set up behind the scene thank you.

    • @aapkanigam
      @aapkanigam  5 ปีที่แล้ว

      Did you pass required credentials

  • @gamalielreyes4930
    @gamalielreyes4930 6 ปีที่แล้ว +1

    When l try to use the breakpoint it goes directly and shows me the message "success", what's the problem?

  • @aaronaaronaaron5922
    @aaronaaronaaron5922 7 ปีที่แล้ว

    Thank you so much great Ashish!!!!!

  • @JupyTerGaming
    @JupyTerGaming 5 ปีที่แล้ว

    Thanks buddy

  • @hardiksharma3556
    @hardiksharma3556 4 ปีที่แล้ว

    sir i want to send image inside the email body please guide me how i can do this...

    • @aapkanigam
      @aapkanigam  4 ปีที่แล้ว +1

      You can create a string of HTML containing image with image url . Then pass it to send method

    • @hardiksharma3556
      @hardiksharma3556 4 ปีที่แล้ว

      @@aapkanigam Sir i uploaded image but when i am sending mail the image is not display instead its encrypt form is visible that is base64-image...

  • @abrahamrussom255
    @abrahamrussom255 7 ปีที่แล้ว

    Thank you sir. Wonderful

  • @yashwanthkumar5986
    @yashwanthkumar5986 7 ปีที่แล้ว

    ashish can you please upload the custom authorization using IAuthenticationFilter Concept

  • @muhammadshoaibkhan8957
    @muhammadshoaibkhan8957 4 ปีที่แล้ว

    thanks ashish sir

  • @aliraza66-h1b
    @aliraza66-h1b 7 ปีที่แล้ว

    bundle of thanks big love for you

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว

      +Ali Raza your welcome.. keep learning and sharing

  • @jessietiquis2420
    @jessietiquis2420 6 ปีที่แล้ว

    Thank you so much Ashish you always save me,.. ^^

  • @Tagmesam
    @Tagmesam 6 ปีที่แล้ว

    can you pls make a video on that an admin registered a school and the school get a email by admin side that your id and password is following

  • @letlhogonolosetlhodi7494
    @letlhogonolosetlhodi7494 7 ปีที่แล้ว

    Thank you very much for this sir. All your concepts are clear. Is there a chance we can get real time server/client update using SignalR? That'll be wonderful. Keep up the good work

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว

      +Letlhogonolo Setlhodi thank..if you find thid useful then share among your friends and let them get benefitted

  • @MuhammadIrfan-yn1jb
    @MuhammadIrfan-yn1jb 7 ปีที่แล้ว

    Thankx Alot dear .... Please also make a video on How to send SMS on mobile phone using mvc

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว

      +Muhammad Irfan sure..

  • @NurulHuda-ix1vw
    @NurulHuda-ix1vw 7 ปีที่แล้ว

    hi, i already follow your step but,the email unable to receive on my email.is it issue on port

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว

      +Nurul Huda What error are you getting

    • @Nihila123
      @Nihila123 6 ปีที่แล้ว

      it will not work if u have turned on 2 step verification for your mail

  • @d.choudhary2705
    @d.choudhary2705 7 ปีที่แล้ว

    Hi Ashish, you hv any video fo jquery Grid in MVC if yes then please share it's very important. Thanks God bless.

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว

      +Dinesh Kumar I have to create video on this ..

    • @d.choudhary2705
      @d.choudhary2705 7 ปีที่แล้ว

      Technotips - Ashish thanks. Once you complete video on jquery grid then please share. TC.

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว

      +Dinesh Kumar sure

  • @hardiksharma9817
    @hardiksharma9817 4 ปีที่แล้ว

    Sir If I want to send mail to 50000 user quickly how i can send it...Please reply...

  • @HassanAli-ms6nl
    @HassanAli-ms6nl 7 ปีที่แล้ว

    Thank you good tutorial please can you teach us how make entry form as pdf file when click send information to server pdf has same as information in web page 😅

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว

      +Hassan Ali thanks.. keep learning and sharing

  • @kuldeepnageshwar8622
    @kuldeepnageshwar8622 7 ปีที่แล้ว

    Please attach the code snippets also its better,thank u

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว

      +Kuldeep nageshwar You can visit our blog and code from there ..link will be in description

  • @PhuongPham-xj8ci
    @PhuongPham-xj8ci 6 ปีที่แล้ว

    I tried to follow you step by step but my code still return false . Pls help

  • @mcbimcbi9183
    @mcbimcbi9183 6 ปีที่แล้ว

    can i send email without credentials??

    • @aapkanigam
      @aapkanigam  6 ปีที่แล้ว

      no😊

    • @mcbimcbi9183
      @mcbimcbi9183 6 ปีที่แล้ว

      is there a way to send emails without credentials using asp.net ?? :)

  • @meghamisra5622
    @meghamisra5622 7 ปีที่แล้ว

    Below code is using windows task scheduler for sending a reminder.
    I want this code to keep sending reminder unless all the document has been read.
    the problem with this code is if there are 10 pending documents and someone completed
    at least one document then for rest 9 documents it won't send a reminder.
    if (emailAddresses.Count() > 0)
    {
    var email = new MailMessage();
    foreach (var emailAddress in emailAddresses)
    {
    email.To.Add(new MailAddress(emailAddress));
    }
    email.From = new MailAddress(ConfigurationManager.AppSettings["MailFrom"]);
    email.Subject = "Pending Document";
    email.Body = "DO NOT REPLYPending DocumentThe document \"" + document.Topic + "\" has been pending for " + (DateTime.Now.DayOfYear - document.Created.DayOfYear) + " days. Please notify all associates in your area that the document \"" + document.Topic + "\" is available to be signed. ";
    email.IsBodyHtml = true;
    using (var smtp = new SmtpClient())
    {
    smtp.Host = ConfigurationManager.AppSettings["MailHost"];
    smtp.Port = Convert.ToInt32(ConfigurationManager.AppSettings["MailPort"]);
    smtp.EnableSsl = Convert.ToBoolean(ConfigurationManager.AppSettings["MailSSL"]);
    smtp.Send(email);
    }
    Show less
    REPLY

  • @gogichan492
    @gogichan492 6 ปีที่แล้ว

    It really helps. Thanks

    • @aapkanigam
      @aapkanigam  6 ปีที่แล้ว

      Thanks keep learning and sharing

  • @haroonniaz7148
    @haroonniaz7148 7 ปีที่แล้ว

    Hi Ashish, kidnly make a Feedback Form in Contact Us page