发送电子邮件而无需提供密码

发送电子邮件而无需提供密码

本文介绍了发送电子邮件而无需提供密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用通过单击按钮通过asp.net发送电子邮件的概念.注册后,希望单击告诉朋友"按钮时将邮件发送给其他朋友以引用我们的网站的客户,但尚未准备好提供密码的客户.
他们可以发送没有密码的邮件吗?
请帮忙

谢谢
Soumya

[操作添加]

海,
感谢您的回复


Hi I am using the concept of sending email through asp.net on click of button. After registering, a customer who want to send mail to other friends for referencing our site when clicking a ''Tell to friend'' button, but the customers who are not ready to give their password.
Can they send mail without password.
Please help

Thank you,
Soumya

[Op Adds]

Hai,
Thanks for your response


public void sendmailto_Deal(string from,string to, string body)
{
MailMessage m = new MailMessage();
SmtpClient sc = new SmtpClient();

try
{
m.From = new MailAddress(from, "displayname");
m.To.Add(new MailAddress(to, "displayname"));


m.Subject = " This is a Test Mail";
m.IsBodyHtml = true;
m.Body = body;
sc.Host = "smtp.gmail.com";
sc.Port = 587;
sc.Credentials = new
System.Net.NetworkCredential("xxx", "xxx");
sc.EnableSsl = true;
sc.Send(m);
}
catch (Exception ex)
{

}
}


hai这里我们正在使用此代码
我可以在这里用作空格(")而不是密码吗?
它有效吗?
System.Net.NetworkCredential("xxx","xxx");


hai here we are using this code
here can i use as blank space("") instead of password?
does it work?
System.Net.NetworkCredential("xxx", "xxx");

推荐答案



public void sendmailto_Deal(string from, string to, string body)
{
    MailMessage m = new MailMessage();
    SmtpClient sc = new SmtpClient();
    try
    {
        m.From = new MailAddress("[email protected]");
        m.To.Add(new MailAddress(to, "displayname"));

        m.Subject = string.Format("YourApplicationName - New email from {0}!", from);
        m.IsBodyHtml = true;
        m.Body = body;
        sc.Host = "smtp.gmail.com";
        sc.Port = 587;
        sc.Credentials = new System.Net.NetworkCredential("xxx", "xxx"); // Whatever *your* email server settings are, NOT the users settings
        sc.EnableSsl = true;
        sc.Send(m);
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.Message);
    }
}


这篇关于发送电子邮件而无需提供密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 14:40