Sending email using ASP.NET Core 2.1

Поделиться
HTML-код
  • Опубликовано: 23 янв 2025

Комментарии • 21

  • @DotNetTrainingAcademy
    @DotNetTrainingAcademy  5 лет назад

    Hey friends, Hope you enjoyed and learned a lot in this video.
    Please subscribe to this channel: ruclips.net/channel/UCYl5G87mJQJOOQoAevAzd5w

  • @bigchunk1
    @bigchunk1 4 года назад

    Easy to follow and it works. Thanks.

  • @anilvarma1653
    @anilvarma1653 4 года назад +1

    It works fine in development mode when I deployed in Local IIS server mail is not working (i did not get the mail) any fix

  • @OthmanIStaiteh
    @OthmanIStaiteh 5 лет назад

    It is very useful, Thank You !!

  • @piotrekgor18
    @piotrekgor18 6 лет назад +1

    Hello. Ty for the video.
    I am having trouble though. While trying to connect to gmail smtp host i always get the exception stating that the SSL certificate handshake failed. I guess you were trying to configure it in 8:48 (probably disabling certificate validation at all?) but you deleted that line. It seems to be working on your machine even without configuring it. Do you have any clue what might cause the problem? I am using win 10, do i need to register certificates manually or what..?
    Thanks in advance

    • @DotNetTrainingAcademy
      @DotNetTrainingAcademy  6 лет назад +1

      if you want that code:
      using (var client = new SmtpClient ()) {
      // For demo-purposes, accept all SSL certificates (in case the server supports STARTTLS)
      client.ServerCertificateValidationCallback = (s,c,h,e) => true;
      client.Connect ("smtp.friends.com", 587, false);
      // Note: only needed if the SMTP server requires authentication
      client.Authenticate ("username", "password");
      client.Send (message);
      client.Disconnect (true);
      }
      Check your gmail account secuirty settings enabled if so then disable it because that might block unauthorised mail and also check this new video ruclips.net/video/V8tULZM5qNM/видео.html

    • @DotNetTrainingAcademy
      @DotNetTrainingAcademy  6 лет назад +1

      Make sure you are running your app in https mode

    • @piotrekgor18
      @piotrekgor18 6 лет назад +1

      thank you for your rapid answers. When i added the following:
      client.ServerCertificateValidationCallback = (s,c,h,e) => true;
      it worked. It doesnt validate the server certificate now. I wonder why is it a problem on my machine? looks like i dont have some certificates installed on it. Did you install some additional certificates?
      BTW i will surely check out your latest video, 'cause im actually building a chat application, thanks ;)

  • @kanikasingh7340
    @kanikasingh7340 5 лет назад

    how will we get to know which port no. we have to use , like you have use 587.

  • @pylvr8021
    @pylvr8021 4 года назад

    is this valid for asp.net core 3 ?

  • @isaacsamuel1689
    @isaacsamuel1689 5 лет назад

    Thank you very much brother, you made it very simple and easy. Please, where are the other videos?

  • @rishwanthyellanki8075
    @rishwanthyellanki8075 4 года назад

    ExtendedSocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

  • @GAVIGHUMMAN
    @GAVIGHUMMAN 6 лет назад

    Nice Tutorial

  • @pjasuska
    @pjasuska 6 лет назад

    Hi!
    Nice tutorial first of all!
    Is it possible to send a view as the body of the email?
    Thank you in advance.

    • @DotNetTrainingAcademy
      @DotNetTrainingAcademy  6 лет назад

      You can use html tags because using view is bit complicated but if users asks these stuff more then i will add video on that.
      Alternatively
      var bodyBuilder = new BodyBuilder ();
      bodyBuilder.HtmlBody = "This is some html text";
      message.Body = bodyBuilder.ToMessageBody ();
      client.Send (message);

    • @pjasuska
      @pjasuska 6 лет назад

      Thank you for your response, you helped me seeing the concept.
      Since I'm trying to send newsletters, it would be easier if I could use a view to send the email, instead of on each version of the newsletter, building the HTML body on the controller.
      Thanks a lot for the help.

  • @TheGana9
    @TheGana9 6 лет назад

    nice

  • @ziedbenazzouna1195
    @ziedbenazzouna1195 6 лет назад +1

    thank you

  • @rodrigota7432
    @rodrigota7432 6 лет назад

    Ty bro

  • @omidsarwary7944
    @omidsarwary7944 6 лет назад

    thank you bro