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.
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.
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.
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
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 :)
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 :)
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.
@@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 :)
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.
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.
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
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.
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.
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.
@@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.
@@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.
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. 🙂
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.
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
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.
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
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 ?
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.
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.
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.
Would like to know the answer to this too, as I'm struggling to send an email to SMTP server that uses Implicit TLS 1.2 connection. .NET Framework doesn't support it and it is deprecated in early .NET Core versions and will not be available in newer versions. Sending email is getting much harder - for example - Google Mail is now Implicit only so you cannnot use these classes anymore and need to find alternatives
Nowadays all transactional email is sent via services such as Sendgrid and Mailgun. You basically fire off API calls to the services and all email related handling is abstracted away from you.
would you mind explain why FluentEmail.smtp is secure , but why do microsoft official doc marks it as obsolete and recommends against using it ? ,thanks
Being obsolete doesn't mean not secure. I showed off the simple SMTP because it is something you can do with the built-in tools. The other options (MailKit, etc.) will work the same way, just using those other systems for the actual sending of the email.
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
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 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 RU-vid 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.
@@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: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-f0YeVirKPfw.html (note the time code is included)."
@@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.
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.
One thing I’ve don’t understand about sending emails with c# is why I need an email server to send from? For instance, if I have a website I can have a form that sends an email with mailto: Why can’t I do something like that with asp.net?
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.
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
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.
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....
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
VSCode does not have a "new project" button. Instead, you need to use the command line. This video will help you build C# projects in VSCode: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-r5dtl9Uq9V0.html and this one will help even more with the .NET Command Line: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-RQLzp2Z8-BE.html
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.
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.
@@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.
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.
@@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 I encounterd some invalid IO exceptions (readonly, invalid operation, ...), I tried the DI way as well. Afterwards, I tried with the same configuration but just with the MailKit package (no Fluent) and that does work. I gave FluentEmail another chance by following the examples on the Github repository and then another chance while following the auhor's blog but no luck. Also the Razor templating did not work for me so I left it commented out. Thank you for taking the time to respond, I did not expect that :)! I've watched many of your video's by now and find them very insightful. And for my project I'll just continue rocking the MailKit package. I'm sending mails containing a reference ID in the body and then retrieving them filtered by that ID over an IMAP client.
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?
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.
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
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.
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': ...)"
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?)
I believe I used a technique or two from C# 9. The versions of C# aren't as big a deal (getting the latest one) because using an older version won't hurt anything. It is only when your application does not support the latest version that it is a problem.
@@IAmTimCorey but what if ur app got 100k registers and u have to send verification emails that may fails isnt it a better approach to use queue with retries?
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).
You can use this to do that, although once you get to a certain size, email providers don't like you sending out mass emails like that from your personal account. That's when you would use a service like SendGrid to send out the email. You can still trigger that from C#.
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
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.
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??
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.
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.
Normally a real fan of your videos, but I think you were a bit thin on some details here. Please can you go into more detail about the bacon-wrapped bacon, thank you.
The code would be basically the same. The only difference is that you would activate it and display the results on a form instead of the console window. Is there something specific that you are stuck on? Have you tried it yourself?
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.
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 ?