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
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
Exception:the remote certificate is invalid according to the validation procedure.
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.
Nice video and Thank you very much for giving 4 videos this week.
+Lutfor Rahman thanks ..its 5th one
Thank you sir.
You can use "minLength" to reduce pressure on database.
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..?
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
thank u bro for publishing new tutorial ..I m desperately waiting for your new video ....hope more will come
+Zahidul Emon sure..thanks.. keep learning and sharing
when user click on send email ,it should send an autogenerated OTP to the user ?help me out
Excellent work bro, you saved me ....
Thanks!! Keep learning and sharing 🙏
Can we send message in different email of the user?
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
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.
+Dinesh Kumar thanks .. keep learning and sharing
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
Thanks, Ashish love your way of teaching,
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?
thanks so much
Amazing work bro.
from where do i get user email and password
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.
Did you pass required credentials
When l try to use the breakpoint it goes directly and shows me the message "success", what's the problem?
Thank you so much great Ashish!!!!!
Thanks buddy
sir i want to send image inside the email body please guide me how i can do this...
You can create a string of HTML containing image with image url . Then pass it to send method
@@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...
Thank you sir. Wonderful
ashish can you please upload the custom authorization using IAuthenticationFilter Concept
thanks ashish sir
bundle of thanks big love for you
+Ali Raza your welcome.. keep learning and sharing
Thank you so much Ashish you always save me,.. ^^
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
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
+Letlhogonolo Setlhodi thank..if you find thid useful then share among your friends and let them get benefitted
Thankx Alot dear .... Please also make a video on How to send SMS on mobile phone using mvc
+Muhammad Irfan sure..
hi, i already follow your step but,the email unable to receive on my email.is it issue on port
+Nurul Huda What error are you getting
it will not work if u have turned on 2 step verification for your mail
Hi Ashish, you hv any video fo jquery Grid in MVC if yes then please share it's very important. Thanks God bless.
+Dinesh Kumar I have to create video on this ..
Technotips - Ashish thanks. Once you complete video on jquery grid then please share. TC.
+Dinesh Kumar sure
Sir If I want to send mail to 50000 user quickly how i can send it...Please reply...
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 😅
+Hassan Ali thanks.. keep learning and sharing
Please attach the code snippets also its better,thank u
+Kuldeep nageshwar You can visit our blog and code from there ..link will be in description
I tried to follow you step by step but my code still return false . Pls help
can i send email without credentials??
no😊
is there a way to send emails without credentials using asp.net ?? :)
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
It really helps. Thanks
Thanks keep learning and sharing
Hi Ashish, kidnly make a Feedback Form in Contact Us page