Sending Email in C# using FluentEmail

Sdílet
Vložit
  • čas přidán 19. 06. 2024
  • Sending transactional emails in C# is a fairly common practice, but it does not have to be a difficult one. Instead of struggling to get the code right, especially with the built-in emailing system being deprecated in .NET 5, you can use FluentEmail to quickly and securely send emails using C#. In this video, we are going to see how to send emails, use email templates, and how to easily test our email delivery system without using a production email server.
    Source Code: leadmagnets.app/?Resource=Sen...
    Mailing List: signup.iamtimcorey.com/
    Purchase Courses: iamtimcorey.com
    0:00 - Intro
    1:00 - Creating Demo Console App
    3:46 - FluentEmail NuGet reference
    6:08 - Establishing Email server
    8:05 - Sending e-mail to directory
    15:19 - Email variable explained
    16:12 - View the email
    17:10 - Send email to papercut smtp app
    19:12 - Email body template: FluentEmail Razor NuGet
    27:53 - Summary and concluding remarks
    Chapter breakdown provided by Ralfs HBK

Komentáře • 305

  • @haithamkarim9755
    @haithamkarim9755 Před 3 lety +58

    The best thing about Tim's tutorial is that he doesn't tell you do this and that but he explain why he is doing each step. Thanks Tim for the great work. Really useful.

  • @digestingpuma5597
    @digestingpuma5597 Před 3 lety +1

    Love the way he talks and explains things. Also, from every video, you can grab bunch of "unrelated", but very helpful tips and hints .

  • @davidjnevin
    @davidjnevin Před 2 lety +1

    Excellent as always! Really learning lots with every video. Thanks so much. Would love to see a video on a sendgrid api integration, not just sending mails but adding contacts, working with segments etc.

  • @edotk4479
    @edotk4479 Před 3 lety

    You are a saviour man,I was working on a worker service with the same FluentEmail package.I was just confused about using Renderer.This video saved me .Thanks for the video :)

  • @TheMegaloYT
    @TheMegaloYT Před 3 lety +6

    I am a self-taught programmer and until now I have always avoided working with emailing with C#. With FluentEmail and your explanation on how to use it, I'm no longer hesitant about incorporating emailing functionality into my personal projects. Thank you.

  • @lukoppc
    @lukoppc Před 3 lety

    Wow, your videos are longer than the others but watching them makes me learn for true and understand the hole thing. Thank you very much.

    • @IAmTimCorey
      @IAmTimCorey  Před 3 lety

      My approach is to teach for the real world. That includes best practices, what to avoid, and how to integrate it into actual projects. That takes longer but, as you have seen, provides a lot more value.

  • @jedidiahmay2092
    @jedidiahmay2092 Před 3 lety +1

    This is absolutely, exactly what I was looking for. Thanks much!

  • @alibarznji2000
    @alibarznji2000 Před 3 lety

    I appreciate all the efforts you put into these videos.
    Thank you💙

  • @NetMistro
    @NetMistro Před 2 lety

    Thanks, Tim for all your videos. They really help!

  • @thomstunes6485
    @thomstunes6485 Před 3 lety +2

    Tim, you're content is just amazing, and by far the best on youtube. Ice on the cake, it's free ! Here's a little suggestion : could you add in your tutorials a section about commons bugs and crashes and how to fix them. Note that this is not related to this particuliar video, i've not tried it yet :)

    • @tomthelestaff-iamtimcorey7597
      @tomthelestaff-iamtimcorey7597 Před 3 lety

      Tim does cover bug fixes in some of his full app development projects, like Tournament tracker and TimCo. Still, I did capture your suggestion on Tim's viewer suggestions list. Thanks for sharing.

    • @thomstunes6485
      @thomstunes6485 Před 3 lety

      @@tomthelestaff-iamtimcorey7597 Yep, it happened to me following one of tim's tutorial... had a really shitty bug and it took me 2 days to find the aswer on the web... so it would be nice :)

  • @essamsalah829
    @essamsalah829 Před 3 lety +4

    why every time I watch aTim video in a specific subject a learn smth new in another subject,
    thanks Tim

    • @tomthelestaff-iamtimcorey7597
      @tomthelestaff-iamtimcorey7597 Před 3 lety

      Tim is an amazing educator. He always tries to show how the topic he is teaching about relates to other key topics. Thanks for sharing.

  • @TheBausahab
    @TheBausahab Před 3 lety

    Thank you Sir;
    I found every phrase extremely useful said by you..
    Thanks for sharing your valuable Experience among us...

  • @chrisreddy3926
    @chrisreddy3926 Před 3 lety +1

    Another fantastic video and a real gem for improving my toolbox. I'd really like to see how you'd add bootstrap to the email template and include tables with foreach from a model

    • @IAmTimCorey
      @IAmTimCorey  Před 3 lety

      You won't be able to add Bootstrap because external CSS files are not allowed in email. You have a limited ability to embed CSS in an email, but it gets tricky fast.

  • @wheelsam2659
    @wheelsam2659 Před rokem

    Tim... you legend. Finding this video made my day and is going to save me a ton of time.

  • @Comphonia
    @Comphonia Před 3 lety

    I was really hoping you'd use the paper cut SMTP you mentioned in the top 10 tools. And boom! You did 😁. Thanks!

  • @email195
    @email195 Před 3 lety

    Another great video Tim. I have been using Exchange WebServices to send emails which allows the email to be placed in sent items after sending which I haven't figured out how to do using SMTP. I really like the Razor Template that you used in this example. Looks like FluentEmail uses RazorLight. I really like the PAPERCUT SMTP tool as well.

  • @captainalpha4853
    @captainalpha4853 Před 3 lety

    Thanks Tim!

  • @maxjustmax521
    @maxjustmax521 Před 3 lety +2

    the best setting I've changed in my VS IDE was the: Display inline parameter name hints, as this explains a lot for me as a new learner all thanks to how your code looks like in the video!
    I always wondered how does Tim have the name of the parameter displayed as hints in the code!
    well thank you so much for motivating me to find it in settings

    • @tomthelestaff-iamtimcorey7597
      @tomthelestaff-iamtimcorey7597 Před 3 lety +1

      Thanks for sharing. I'm sure this will motivate others to explore and tweak their settings also.

    • @JaroslavFurman
      @JaroslavFurman Před 3 lety +1

      Was looking if somebody commented on this.

    • @maxjustmax521
      @maxjustmax521 Před 3 lety

      @@JaroslavFurman I hope you got the answer you need.

  • @haroldpepete
    @haroldpepete Před 3 lety

    you explain clear and good, thank for share with us, God bless you

  • @ana-mariaolujic6570
    @ana-mariaolujic6570 Před 2 lety

    Great tutorial

  • @Yodigity
    @Yodigity Před 3 lety +2

    Really great video Tim. I had one request, I'd be interested to see how you would work with XML. I understand JSON is generally more accepted, but I noticed some places are still a fan of XML. 🙂

  • @juhairahamed5342
    @juhairahamed5342 Před 2 lety

    Good explanation

  • @jovi811209
    @jovi811209 Před 2 lety

    Thanks for the vedio Tim, really great vedio.
    There is a question, what's your recommendation to send large amount of mails at a time using FluentEmail (e.g. 10,000)?
    If FluentEmail is not supported, is there any suggestion ?

  • @dyakobaram
    @dyakobaram Před 3 lety +8

    hello Mr Tim, have you thought about creating community polls on youtube for your upcoming videos so we can vote for your next tutorials?

    • @tomthelestaff-iamtimcorey7597
      @tomthelestaff-iamtimcorey7597 Před 3 lety +4

      We have discussed that a couple times. Tim is actually exploring multiple options, at the moment, to handle getting viewer feedback. Stay tuned and watch the newsletter for more info.

  • @oscarpina9753
    @oscarpina9753 Před rokem

    Dude you're the best, thank u so much!

  • @parsamoomkesh1346
    @parsamoomkesh1346 Před 3 lety

    Hi Tim. Thanks. Great as always.
    Could you make a video specifically about smtp and all this stuff?

  • @jlitodelcid326
    @jlitodelcid326 Před 3 lety

    Very good video

  • @eduardosoto8563
    @eduardosoto8563 Před 3 lety

    Like always excellent content!
    Could you do a dev series questions video on how to do code reviews? I’m wondering what are best practice and how to do a meaningful code review/pull request.

  • @omarwasfi
    @omarwasfi Před 2 lety

    Thank you so much❤️

  • @rsifodias5
    @rsifodias5 Před 3 lety

    Great video! Having done a bit of business email logic, I would like to add 2 disclaimers: This is great for emails from your own domain, but you'll have to create your own Gmail or Outlook ISender implementation if you want to securely use those platforms. Gmail and Outlook have limited access to their SMTP, and prefer if you use their REST APIs.
    The other thing is that email HTML is more restricted than web HTML. Obviously JS isn't allowed, but there's other things to. Just know that your email won't come out the same as your liquid template.

    • @IAmTimCorey
      @IAmTimCorey  Před 3 lety +2

      I've used Google's SMTP servers without an issue using a personal gmail account. Outlook isn't an email server, it is an email client. If you mean Microsoft's servers (Outlook.com), then you can send through there as well. You just need the correct SMTP settings and the username and password.
      As for the template, my email will format just fine in HTML. There is no JavaScript in it. It renders as plain HTML.

    • @rsifodias5
      @rsifodias5 Před 3 lety

      @@IAmTimCorey Sorry, you're right about SMTP; I was talking about my experiences with the business SMTP gmail service. For personal emails, I believe SMTP is perfectly fine, though there is an issue for older clients - Google restricted authentication from weak-password accounts. Please see this issue: stackoverflow.com/questions/20906077/gmail-error-the-smtp-server-requires-a-secure-connection-or-the-client-was-not?rq=1
      However, email HTML is a whole another can of worms. It took me months to figure out that most email clients to not support CSS3 features. Or background images. Or animations. Or flexbox. Its fine if you're HTML isn't complex, but I wanted to tell users if you're going to write ads or newsletters, you're better off using a templating language like MJML, then writing the razor syntax before you submit the email.

    • @gileee
      @gileee Před 2 měsíci

      @@rsifodias5 Just use an AppPassword generated for you notifications gmail account if you want access from an "insecure app" as they call it, and use that instead of your regular password. SMTP should work just fine after that, granted if you don't go over their pretty strict email limits. Just make sure you have 2-step enabled, because it's a requirement to use AppPasswords.
      Using their API with the Google.Apis.Auth (OAuth2) and Google.Apis.Gmail really is only used with service accounts and when you need to change account settings through your app and other things like that. Not really intended just for sending an email once in a while from what I understand.

  • @kanatej
    @kanatej Před 3 lety

    Thank you.
    It is a very good VDO.It can be applied easily.
    I have a question.Can FluentEmail attach file ?

  • @attilaguba856
    @attilaguba856 Před 2 lety

    As always nice work! Do you have same / or similar / Email sender with Asp net core mvc tutorial too ?

  • @mashanoushad8386
    @mashanoushad8386 Před 2 lety

    Hi Tim,this tutorial is so great.How can i add an inline image for email with Fluent razor.

  • @abhishekjadhav9289
    @abhishekjadhav9289 Před 9 měsíci

    Thank you Tim for the important video on email. Does fluent razor work with .Net 6 worker service project ? Can we include attachments with fluent smpt ?

  • @xw9279
    @xw9279 Před 3 lety

    Hi Tim, thank you for your video.
    A quick question: Do companies use FluentEmail in the industry project as the default choice when they want to create some server Apps to send the data reports regularly?

    • @IAmTimCorey
      @IAmTimCorey  Před 3 lety +1

      It all depends on the company and the situation. Remember that in programming, we have options. We need to make the best choice between the options in every situation rather than prescribing one solution as the "best" option for all situations.

  • @user-oi2kd6kv8v
    @user-oi2kd6kv8v Před 2 lety

    Thanks for this Great video and great explanation, is this method work for sending and receiving emails from exchange server using SSL /TLS. How..?

  • @StudentCompanion
    @StudentCompanion Před 3 lety +1

    Is there a disadvantage by using the .Net smtp class to send email directly compared to fluent email?
    Thanks a gain for the great video.

    • @Osbornesupremacy
      @Osbornesupremacy Před 3 lety +1

      MS recommends not using SmtpClient because it "doesn't support many modern protocols" (that's in their docs). It also doesn't have a proper SendAsync method.

    • @StudentCompanion
      @StudentCompanion Před 3 lety

      @@Osbornesupremacy ok. Thanks wasn't aware of that!

    • @IAmTimCorey
      @IAmTimCorey  Před 3 lety +1

      Yep, Microsoft is deprecating it and recommends against using it.

  • @AhmadAlMutawa_abunoor
    @AhmadAlMutawa_abunoor Před 2 lety +1

    Which version of visual studio do you use? and are using the default version of c# that comes with it? or did you upgrade? I am only asking because I keep seeing argument labels inserted with method calls automatically. Is there an option to do that?

    • @tomthelestaff-iamtimcorey7597
      @tomthelestaff-iamtimcorey7597 Před 2 lety

      Tim talks a lot about Visual Studio and how he uses it. You may want to check out some of what he covers - czcams.com/users/IAmTimCoreysearch?query=visual

    • @AhmadAlMutawa_abunoor
      @AhmadAlMutawa_abunoor Před 2 lety

      @@tomthelestaff-iamtimcorey7597 I had to watch several videos hoping to spot where I can configure my Visual Studio to automatically display named arguments, but failed. I even searched google and CZcams for named arguments in c#. all of the results talk about the possibility of calling methods using named arguments, but none of them tells how visual studio automatically inserts named arguments for you if you don't specify that.

    • @tomthelestaff-iamtimcorey7597
      @tomthelestaff-iamtimcorey7597 Před 2 lety

      @@AhmadAlMutawa_abunoor I caught Tim and managed to get the following for you. I hope it helps: "I'm using the standard Visual Studio 2019 Community Edition with no additional plug-ins except the font resizer. The label option is a new feature that I explain here: czcams.com/video/f0YeVirKPfw/video.html (note the time code is included)."

    • @AhmadAlMutawa_abunoor
      @AhmadAlMutawa_abunoor Před 2 lety

      @@tomthelestaff-iamtimcorey7597 Thanks a lot. I have Visual Studio 2019 Community Edition Version 16.10. The feature is not included anymore. I guess they decided to remove it (hence the "experimental" tag in VS version 16.08 )
      I searched all settings for (inline parameter name hints) but found none, and nothing else that accomplishes the same feature.

  • @abdallabenomran6809
    @abdallabenomran6809 Před 3 lety

    the best man in USA thank you

  • @argeelearner3978
    @argeelearner3978 Před 3 lety

    Thank you

  • @starkillermx
    @starkillermx Před rokem

    Great video! One question, how can I set the credentials for the seder? user and password. Many thanks!

  • @DaNoob_777
    @DaNoob_777 Před 2 lety

    Thanks!

  • @amirnorozi1085
    @amirnorozi1085 Před 2 lety

    thanks man

  • @matheusgeorgo
    @matheusgeorgo Před 3 lety

    Hello Tim, that's a great video.
    I would like to sugest the topic of Nswag, and how to generate and utilize the client generated from swagger. Thank you.

  • @devlife013
    @devlife013 Před 3 lety +1

    Thanks for the video Tim.
    I just want to share my experience, I created a Class Library (.Net Core) and named it as EmailSender.
    after creating the project I installed FluentEmaill.Smtp, when I tried to use SmtpSender() the namespace FluentEmail.Smtp did not include into the class "Cannot resolve symbol FluentEmail" , however I added it manually but got that issue again.
    I found out my project name "EmailSender" has some conflict and after changing my project name the problem gone.

    • @tomthelestaff-iamtimcorey7597
      @tomthelestaff-iamtimcorey7597 Před 3 lety

      Thank you for sharing the experience. I'm sure you will save others from struggling with similar issues, saving both time and frustration.

  • @vitorarchanjovasconcelosch1444

    Amazing as always!! Please, make a video about TDD Tim, would be fantastic!

  • @rightobjectaccount9765
    @rightobjectaccount9765 Před rokem +1

    Hi Tim,
    Nice tutorial- very helpful. I have a question- how do I add a logo to an email body using the Fluent email framework? Does Fluent support add any logo at all? Love your tutorials. Thanks

    • @IAmTimCorey
      @IAmTimCorey  Před rokem

      Yes, but that isn't a Fluent email-specific thing. You can check their documentation, though.

    • @rightobjectaccount9765
      @rightobjectaccount9765 Před rokem

      Thanks for your reply. By doing an attachment, I can show an inline image onto the email body. But not sure if that’d be the right way to do it. I wish I could find any document about the binding inline image using the FluentEmail package. Look forward to seeing more tutorials from you.

  • @diegoronkkomaki6858
    @diegoronkkomaki6858 Před 3 lety

    Does this library have helpers for creating ics-files / email calendar invitations? I've had experiences where I had to create a C# application that sends email calendar invitations and working with ics/vcalendar properties manually was kind of a nightmare.

  • @AndrewLyzlov
    @AndrewLyzlov Před 3 lety

    Thank you, Tim! How would you attach a file to an email? How would you save a copy in 'sent' folder of Outlook?

    • @florianvandillen
      @florianvandillen Před 3 lety

      If you need to send as yourself in a Office365 environment, I'd suggest using the Graph API instead of a third party service.

  • @codingwithgyver1637
    @codingwithgyver1637 Před 3 lety

    I didnt know that their is a safe way to test an email service without affecting the production email.
    That is when the debugging program has a bulk send and the email hosting has sending limit and it will cause to our organization to stop receiving inquiries via emails.
    Then, my work will go easier with your @Model instead of "Dear [ClientName]" then using String.Replace("[ClientName]",clientName) as it was impractical and it was not easy to do refactoring for the parameter names I created.
    Thank you again @TimCorey and cheers to you sir.
    Btw, can I request about jumping out to updates to newer version like from what should to do when upgrading NetCore 2.1 into Net5 or from Angular 6 upgrading into Angular 11? Should we do direct upgrade or step-by-step/incremental updating? that is what I facing right now with existing projects using older frameworks and I cant use the nuget/npm package because it needs a higher version of it. and of course, I need the latest version of it to improved performance and security of the applications we made

    • @tomthelestaff-iamtimcorey7597
      @tomthelestaff-iamtimcorey7597 Před 3 lety +1

      In my QA background, we never adequately solved the testing of bulk emails issues, other than just blasting our own team with emails over and over (not a good option.) Thanks for the suggestion for videos on upgrading methods. I have added that to Tim's viewer suggestions list.

  • @saaimurugan11
    @saaimurugan11 Před 2 lety

    Hi Tim, Fantastic video, I have a question, how do I make the CC optional?

  • @yingxing4134
    @yingxing4134 Před 2 lety

    Great video Tim, thank you so much! One question, is it possible to use template with subject?

    • @IAmTimCorey
      @IAmTimCorey  Před 2 lety

      Not sure what type of template you mean. If you are asking if you can use string interpolation or something similar for subject lines, then yes. If you are asking about a template on the email side of things, then no.

    • @yingxing4134
      @yingxing4134 Před 2 lety

      @@IAmTimCorey Happy holidays Tim! Yes that's what I mean. An example in my application is to include the ID within the email subject, and maybe other information, it would be handy to have a template for the subject as well.

  • @windowsbuilderthegreat3121

    Could you do a video explaining when to use structs and classes when using graphical/console applications

  • @fieryscorpion
    @fieryscorpion Před 3 lety +1

    Hi Tim,
    Can you please create a video tutorial on how to receive and consume messages using Mass Transit?
    Thank you!

    • @IAmTimCorey
      @IAmTimCorey  Před 3 lety +1

      I’ll add it to the suggestion list.

  • @satori8626
    @satori8626 Před rokem

    Can FluentEmail also be used to read the emails that you receive from others, or would you use something different for that purpose?

  • @sruthivasudevan960
    @sruthivasudevan960 Před 2 lety

    Hi Tim, Excellent Tutorial. I am getting the following error when I tried to use local host and port 25. Any thoughts?
    No connection could be made because the target machine actively refused it. [::1]:25

  • @rjean99
    @rjean99 Před 3 lety

    Great video. Question: SmtpClient is marked as obsolete and MS recommends against it's use, however, it is being shown here. Does the sender have to be SmtpClient? confused....

    • @rjean99
      @rjean99 Před 3 lety

      Actually, just checked the latest guide and you can configure other senders, including MailKit: lukelowrey.com/dotnet-email-guide-2021/ I'm guessing you showed System.Net.Mail as a matter of convenience - this is just an FYI for those looking at using FluentEmail that you CAN configure other senders

  • @BobRossRightHand
    @BobRossRightHand Před 3 lety

    What a timing, I'm just about to start developing a simple app where I want an email to be sent to me every now and then! Thank you! In the future I would like the app to send SMS, could you make a video about that aswell?

    • @tomthelestaff-iamtimcorey7597
      @tomthelestaff-iamtimcorey7597 Před 3 lety +1

      Thanks for the suggestion, I added it to Tim's suggestion list. That list really does influence what videos Tim works on, but be aware that he gets a lot of 'suggestions'. I believe he addresses the SMS capabilities in the paid version of the TimCo series on IAmTimCorey.com, if you are in a hurry. (Correction - Not TimCo, it is Tournament Tracker. Thanks Tim!)

    • @IAmTimCorey
      @IAmTimCorey  Před 3 lety +1

      It is the paid version of the Tournament Tracker application.

  • @Vitalick15
    @Vitalick15 Před 3 lety

    Thanks))

  • @WTHBrou
    @WTHBrou Před 3 lety

    How would you setup this Console Application to run as a service or complement with an API. Core Server. Use this to handle Email Confirmations from Register/Lost Account routes functions.

  • @rameshshinde9635
    @rameshshinde9635 Před 2 lety

    Hi Tim,
    Thanks for the video.
    How we can capture Bounced Email (Non-Delivery Report) in C#?

    • @IAmTimCorey
      @IAmTimCorey  Před 2 lety

      You would need to read the email in the inbox unless you use a service that does it for you.

  • @christopherbaldwin1194
    @christopherbaldwin1194 Před 3 lety +1

    Hey Tim hobbyist coder, how do I get the properties to how up like hints in the code like you do? So SmtpClient(host: "localhost" the host: hint is what I'm trying to activate as I like this for developing especially if it's been a few month since looking at the project

  • @mohamedgadallahbasheer5606

    Hi.
    Just found your channel by chance.
    Please sir how to contact you by email.
    I want to enroll into all your courses.
    I found there are individual 26 courses in your website, plus some bundles.
    Also found the black friday copoun.
    I am a bit confused for which bundle includes all your courses?

  • @pathumniroshan6145
    @pathumniroshan6145 Před 3 lety

    Thank you Tim, Would you also be able to do a video on How to send Whatsapp and Text messages too. Appreciate it.

    • @IAmTimCorey
      @IAmTimCorey  Před 3 lety +1

      I can add that to the suggestion list.

  • @dmytrohryshyn
    @dmytrohryshyn Před 3 lety +4

    Thank you, as always lovely lesson. Would you consider to cover sending SMS message via C#, there are a lots of topics but I found this topic a bit hard for me, but it is essential skill for a good developer. Interesting to hear your thoughts.

  • @myaloy
    @myaloy Před 3 lety

    Quick question - what theme are you using for VS? Also, can a .Net 5 email compone be consumed by Framework (4.6 and above ) apps ? Thanks

    • @IAmTimCorey
      @IAmTimCorey  Před 3 lety

      I'm using the built-in dark theme. As for consuming a .NET 5 project in .NET Framework, no, you can't do that but you can make the .NET 5 library a .NET Standard 2.0 instead and then it will work (both with .NET 5 and .NET Framework 4.6.1 and above).

    • @myaloy
      @myaloy Před 3 lety

      @@IAmTimCorey Wow, such a quick reply - Thanks

  • @marcusmaunula5018
    @marcusmaunula5018 Před 3 lety

    Nice Library

  • @FreneticGamer
    @FreneticGamer Před 3 lety

    Hi, thanks for content, awesome video, About line 34 in 30:07, what name plugin/extension show parameters name, e.g ".To('email Address':...., 'name': ...)"

    • @IAmTimCorey
      @IAmTimCorey  Před 3 lety +1

      Here is how you do that: czcams.com/video/f0YeVirKPfw/video.html

    • @FreneticGamer
      @FreneticGamer Před 3 lety

      @@IAmTimCorey Thanks ;)

  • @konstantinoskinnas789
    @konstantinoskinnas789 Před 3 lety +3

    Thanks that was exactly what I was waiting for! Also could you do a video on a c sharp CMS equivelant to wordpress?

  • @cupelappsteam657
    @cupelappsteam657 Před 2 lety

    Hi Tim,
    Thank you for the video. But I am curious that a windows server and a domain name are enough for this to work ( say amazon EC2 windows server?)

    • @IAmTimCorey
      @IAmTimCorey  Před 2 lety

      You have to have a mail server to send email.

    • @cupelappsteam657
      @cupelappsteam657 Před 2 lety

      @@IAmTimCorey Thank you, You mean Can I use Gmail as mail server?

  • @igalsavis6491
    @igalsavis6491 Před 2 lety

    very nice ... 10x

  • @abhishekjadhav9289
    @abhishekjadhav9289 Před 9 měsíci

    Hi Tim, In my application I have two choices to go for implementing Email functionality. First option is sending email using Mail kit (that I have used before) and other option is to send using Azure Communication Services (completely new for me). I am confused and would like to know your expert opinion is which one is better than the other and why ? Thank you in advance.

    • @IAmTimCorey
      @IAmTimCorey  Před 9 měsíci

      Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/

  • @S3Kglitches
    @S3Kglitches Před 3 lety

    Is there any good package that you would recommend for Outlook interaction from C# program?
    I mean, sending emails from Outlook account
    Sort of injecting into Outlook
    Why is it not possible to use Fluent Email in WebAssembly?
    Thank you for explaining multiple times that this is the client

    • @turn1210
      @turn1210 Před 3 lety

      You can use the ms outlook 365 exchange directly to send emails, that’s what I’ve done in the past. It avoids having to use a local copy of outlook.

    • @andywalter7426
      @andywalter7426 Před 3 lety +2

      I can say for sure that if you wanted to do from web assembly, then web assembly would have to send to an api who can do the email. Because with web assembly, everything runs on the client. Browsers don't let you send emails though. If a person had a blazor app that needed to send emails, the best is to have an interface service. The blazor server side can do this way. In web assembly, you send to a web api and the web api can do it. The page would not care how its done.

    • @jessecavada3015
      @jessecavada3015 Před 3 lety

      EWS aka Exchange Web Services. Add package “Exchange.WebServies.Managed.Api” into your .net project.

    • @S3Kglitches
      @S3Kglitches Před 3 lety

      @@andywalter7426 Ah thanks for pointing out the secrets of web assembly in short, I'm very new to it

    • @S3Kglitches
      @S3Kglitches Před 3 lety

      @@jessecavada3015 This package for what exactly? Thank you!

  • @leonroutzounis383
    @leonroutzounis383 Před 2 lety +1

    Thanks Tim for the tutorial.
    However I get an error message as follows.
    "No connection could be made because the target machine actively refused it."
    How can I fix that??

    • @IAmTimCorey
      @IAmTimCorey  Před 2 lety

      Sounds like there is an issue with the firewall.

  • @Osbornesupremacy
    @Osbornesupremacy Před 3 lety +3

    Any thoughts on MailKit vs. FluentEmail ?

    • @Osbornesupremacy
      @Osbornesupremacy Před 3 lety

      okay, it looks like MailKit is a dependency of FluentEmail. What exactly does FluetEmail add to MailKit -- template support and syntactic sugar?

    • @IAmTimCorey
      @IAmTimCorey  Před 3 lety +3

      You are correct in your assumptions. FluentEmail makes MailKit simpler to use (fluent) and supports nice templates (plus some other smaller bonuses).

  • @medupiramaboea7742
    @medupiramaboea7742 Před 2 lety

    Can I please get an example of a rich Razor template, something that can be used for send styled emails to clients.

    • @IAmTimCorey
      @IAmTimCorey  Před 2 lety

      Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/

  • @rodrigo6459
    @rodrigo6459 Před 3 lety

    Hello Tim!! great video!! i enjoyed it from start to end!, but have a question for you... in order to create very good looking emails you have to actually create an HTML file with a reference to a CSS file and use that as a template, is it possible to store that template in a folder and read the file to fill a string variable and let FluentEmail.Razor render the whole thing replacing @Model text that hsould be pressent at the template level?. How will FluentEmail.Razor will handle the CSS references, will it just attach the file to the email?...
    Also, wanted to ask if there is a chance you can do a video for authorization and authenticantion not using the "template" tables that microsoft provides when you create a new ASP.NET Core MVC proyect, that will be a GREAT thing to have here!, i know you have a video you did a couple of years ago but that one depended heavelly on the templates, normally you want your own stuff.
    Thanks for the great effort and work!

    • @rodrigo6459
      @rodrigo6459 Před 3 lety

      Have been trying my self and images just keep referencing the folder where i store them ()... BTW, my whole HTML is comming from a template .html file i´m referencing using the "UsingtemplateFromFile" stuff.

    • @rodrigo6459
      @rodrigo6459 Před 3 lety

      So... IF you want an image as part of your template is a 3 step thing you need to do, for example, add this line to the HTML template , step 2: convert the image you want into a Base64String reading the file to a byte array, and build a string with something like this string image = $"data:image/png;base64,{Convert.ToBase64String(imageArray)}"; and FINALLY replace the @Model.ImageArray with the full string you just created. Too bad this is not part of the documentation for FluentEmail.Razor, but i will leave it here just in case someone needs it!

    • @tomthelestaff-iamtimcorey7597
      @tomthelestaff-iamtimcorey7597 Před 3 lety

      @Rodrigo - Thank you so much for this tip. I'm sure other folks will find this beneficial. This is obviously hard earned experience and could save others hours of research.

  • @Gauravkumar-jm4ve
    @Gauravkumar-jm4ve Před 3 lety

    Tx👍

  • @michelchaghoury870
    @michelchaghoury870 Před 3 lety

    gr8 video, can you please make a video about an ASP.NET MVC or blazor web app with auth when the client either sign up or sign in he will be receiving an email like you have been sign in to ... or if he sign up like a welcome and greeting email please and tnx alot

  • @vandeljasonstrypper6734

    Tim can you make a video to use openxml generate word and excel ?

  • @solidtyper
    @solidtyper Před 2 lety

    how do you know if the email was sent or not, and in case of an error at the email address how can you catch that?

  • @StudentCompanion
    @StudentCompanion Před 3 lety +1

    Thanks a aging Tim, could also consider a video to receive emails?
    Really appreciated.

  • @reinoutko
    @reinoutko Před 2 lety

    I get this error for all 3 properties in the SmtpClient "smtpsender does not contain a definition for {propertyname}"

  • @nimecloud
    @nimecloud Před 2 lety

    In Blazor app what will be the sender IP address? Wasm vs Server versions.

    • @IAmTimCorey
      @IAmTimCorey  Před 2 lety

      You cannot send email from Blazor WebAssembly, since client-side cannot do secure operations (all of the source code is sent to the client in clear text). For Blazor Server, it would be the server's IP address.

  • @RalfsBalodis
    @RalfsBalodis Před 3 lety +20

    0:00 - Intro
    1:00 - Creating Demo Console App
    3:46 - FluentEmail NuGet reference
    6:08 - Establishing Emali server
    8:05 - Sending e-mail to directory
    15:19 - Email variable explained
    16:12 - View the email
    17:10 - Send email to papercut smtp app
    19:12 - Email body template: FluentEmlai Razor NuGet
    27:53 - Summary and concluding remarks

    • @tomthelestaff-iamtimcorey7597
      @tomthelestaff-iamtimcorey7597 Před 3 lety

      Ralfs, Thank you so very much, I will move this over immediately. We know how much this work helps the rest of the community. Tim truly appreciates your work on this.

    • @jasonwellsnorris
      @jasonwellsnorris Před 3 lety

      @@tomthelestaff-iamtimcorey7597 I believe "FluentEmlai" would be a typo.

    • @tomthelestaff-iamtimcorey7597
      @tomthelestaff-iamtimcorey7597 Před 3 lety

      @@jasonwellsnorris Thanks for the heads up. That slipped past me.

  • @OrAssraf
    @OrAssraf Před 3 lety +1

    Hi Tim! Are you planning on creating Xamarin new content?

    • @tomthelestaff-iamtimcorey7597
      @tomthelestaff-iamtimcorey7597 Před 3 lety +1

      I know its on the suggestion list already, but I added your suggestion also.

    • @OrAssraf
      @OrAssraf Před 3 lety

      @@tomthelestaff-iamtimcorey7597 we all be very interested having Xamarin explained by Tim

    • @tomthelestaff-iamtimcorey7597
      @tomthelestaff-iamtimcorey7597 Před 3 lety

      That is why I keep adding to Tim's list, so he can gage the level of interest in specific topics. He still decides what videos he will make, but I know the list has a lot of influence! So keep up the suggestions!

    • @IAmTimCorey
      @IAmTimCorey  Před 3 lety +2

      Xamarin will be waiting until at least .NET 6 because of the upcoming major changes to it (November 2021)

    • @OrAssraf
      @OrAssraf Před 3 lety

      @@IAmTimCorey looking forward

  • @datcolsol
    @datcolsol Před 3 lety

    When I want to use a production SMTP server how do I specify the user credentials?

    • @IAmTimCorey
      @IAmTimCorey  Před 3 lety

      Here you go: stackoverflow.com/a/56075014/733798

  • @mediaofhogwarts
    @mediaofhogwarts Před 3 lety

    I tried to implement this on an API. I can see the mail being sent on the PaPErcut SMTP application but i cant see the mail on the gmail site on the receivers mail. Any idea why this happens ?

    • @IAmTimCorey
      @IAmTimCorey  Před 3 lety

      If you are sending to Papercut, you aren't sending to GMail. You have to change over to use your actual SMTP server in order to send "real" email.

  • @bigdummyhead2162
    @bigdummyhead2162 Před 3 lety

    Do you and or can you make a video on P2P (TcpClient/TcpListeners) on the System.Net.Sockets namespace in C#?

  • @BarriDuty
    @BarriDuty Před 3 lety +1

    what is the plugin to see the parameters name in methods?

    • @dyakobaram
      @dyakobaram Před 3 lety +2

      it is not a plugin it is a option in vs2019 wich still experimental
      Tools > Options > Text Editor > C# > Advanced >Editor Help section > display inline parameter name hints (experimental)

    • @tomthelestaff-iamtimcorey7597
      @tomthelestaff-iamtimcorey7597 Před 3 lety +1

      @@dyakobaram Thanks for the tip / clarification!

    • @dyakobaram
      @dyakobaram Před 3 lety

      @@tomthelestaff-iamtimcorey7597 glad I could help :)

  • @arunjoshi7885
    @arunjoshi7885 Před 3 lety +1

    Which extension you use for specificy method argument ,like name ,to

    • @rolandomedina7140
      @rolandomedina7140 Před 3 lety

      I was going to ask the same

    • @IAmTimCorey
      @IAmTimCorey  Před 3 lety

      That's the FluentEmail system. It created those extension methods.

    • @arunjoshi7885
      @arunjoshi7885 Před 3 lety

      @@IAmTimCorey can you please make a video on, which extensions you are using in visual studio.

    • @asendall
      @asendall Před 3 lety +1

      I think this is what you are after Tools > Options > Text Editor > C# > Advanced and select Display inline parameter name hints (experimental).

    • @arunjoshi7885
      @arunjoshi7885 Před 3 lety

      @@asendall thanks for this

  • @hieuvo8460
    @hieuvo8460 Před 2 lety

    Does it offer email encryption?

  • @rmw82a
    @rmw82a Před 3 lety

    If you can't use this for Web assembly, what could you use?

    • @tomthelestaff-iamtimcorey7597
      @tomthelestaff-iamtimcorey7597 Před 3 lety +1

      @rmw82a - Check out the replies to S3Kglitches comment below. I believe it addresses at least part of what you are looking for.

  • @lborate3543
    @lborate3543 Před 3 lety

    I use email from .net console/web apps all the time. Wrap my class calls in try/catch and email the exception message to the it group for any errors. We catch errors instantly, and get what failed and can start fixing it, even before the ticket comes in.

    • @IAmTimCorey
      @IAmTimCorey  Před 3 lety

      Great!

    • @lborate3543
      @lborate3543 Před 3 lety

      @@IAmTimCorey finally able to contribute to the IATC group something positive.

  • @master1986a
    @master1986a Před 2 lety

    Nice vid!, Is there a way to make it work with net core 6? I get a PlatformNotSupported exception. Thanks.

    • @IAmTimCorey
      @IAmTimCorey  Před 2 lety

      It should work. Can you try upgrading the package?

    • @master1986a
      @master1986a Před 2 lety

      @@IAmTimCorey I forgot to mention i'm user Blazor WebAssembly, i got a warning on code that says "SmtpClient" not supported on 'browser'. Maybe it's because i souldt move it to Server? Sorry for my english.

    • @IAmTimCorey
      @IAmTimCorey  Před 2 lety +1

      Ah, that’s the issue. Blazor WebAssembly runs fully on the client, so it cannot do secure actions like sending emails directly.

  • @mrmoinn
    @mrmoinn Před 3 lety +1

    So if I change localhost to Gmail.com it'll send through Gmail? How do I authenticate myself, though? I'm a bit confused..

    • @maxjustmax521
      @maxjustmax521 Před 3 lety +3

      var client = new SmtpClient("smtp.gmail.com", 587)
      {
      Credentials = new NetworkCredential("YourMail@gmail.com", "YourPassword"),
      EnableSsl = true
      };
      in order for that to work you will need to change your gmail account security to let your C# application access your mail (on your own risk!)
      go to gmail account -> security - Allow less secure apps: ON

    • @joshuapoitras2099
      @joshuapoitras2099 Před 3 lety

      @@maxjustmax521 What else did you end up changing as far as creating the email itself?

  • @chacataplan
    @chacataplan Před rokem

    I have a problem, I want to send different emails to each user but the first user receives the 3 emails, use foreach to iterate with each user, what am I doing wrong, regards

    • @IAmTimCorey
      @IAmTimCorey  Před rokem +1

      I can't be certain what you are doing wrong, but this is an excellent time to practice your debugging skills. You will learn more by debugging this problem than you would by getting the answer.

  • @soumikmahajan6317
    @soumikmahajan6317 Před 3 lety

    Any thoughts on SendGrid?

  • @nathanzimmerman8422
    @nathanzimmerman8422 Před rokem

    I need to send mail to a list of recipients selected from a sql server table. Can you show how?

    • @IAmTimCorey
      @IAmTimCorey  Před rokem

      Break the problem down into steps. This video shows you how to send an email. That's a step. Now figure out how to get data out of SQL (there are videos on this channel for that if you need help). Then figure out how to loop over your data and call the email method. Put it all together and you are set.

  • @Ultimate_Cubchoo
    @Ultimate_Cubchoo Před 2 lety

    Thank you now I can send a worm to people I don't like👍