我只是尝试从C#.Net Web应用程序发送邮件,但当我使用Smtp它实际上不会来的只有Smtp [英] Just I Try To Send Mail From C#.Net Webapplication But When I Used Smtp It Will Not Come Actually Came Smtp Only

查看:111
本文介绍了我只是尝试从C#.Net Web应用程序发送邮件,但当我使用Smtp它实际上不会来的只有Smtp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上在那个括号中只是自动键入smtp默认不来,所以我的邮件也没有去请帮帮我。







SmtpClient MailClient = new SmtpClient(smtp.gmail.com,465);



MailClient.Credentials = new System。 Net.NetworkCredential(jothi.rjk05@gmail.com,密码);

MailClient.Send(Emailmsg);

Actually in that bracket am only typed automatically that "smtp" defaultly doesnt come so my mail also not going please help me.



SmtpClient MailClient = new SmtpClient("smtp.gmail.com",465);

MailClient.Credentials = new System.Net.NetworkCredential("jothi.rjk05@gmail.com","Password");
MailClient.Send(Emailmsg);

推荐答案

//sending Email.
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
                msg.To.Add(TextBox1.Text);//Read user email id here for which u have to send email
                msg.Subject = "Forgot password.";
                msg.From = new System.Net.Mail.MailAddress("autoemail@xyz.com");
               
                msg.Body += "Have a great day!\n"; // Add email body as u like.
                msg.Body += "  \n  ";
                msg.Body += "-Team\n XYZ services!";
 
                System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("localhost");//replace the localhost with hosting server name.For example in case of godaddy it is "relay-hosting.secureserver.net"
                smtp.Send(msg);





试试这个!!



Try this!!


这篇关于我只是尝试从C#.Net Web应用程序发送邮件,但当我使用Smtp它实际上不会来的只有Smtp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆