发送电子邮件而无需提供密码 [英] Send email without giving pwd

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

问题描述

我正在使用通过单击按钮通过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");

推荐答案

为什么不在任何电子邮件服务器上创建单个不答复用户帐户您正在使用,并且当用户单击告诉朋友"时,您可以形成电子邮件(在主题行中使用用户名),并从普通用户帐户发送电子邮件,而他们不会无需输入任何内容,包括其用户ID或电子邮件帐户密码.他们所要做的就是单击按钮,然后网页为他们完成剩下的工作.
Why don''t you create a single no-reply user account on whatever email server you''re using, and when the users click "tell a friend", you can form the email (using the user''s name in the subject line), and send the email from the common user account, and they don''t have to enter ANYTHING, including their user Id or the email account password. All they have to do is click the button, and the web page does the rest for them.


但是还没有准备好提供密码的客户.
不是必需的个人密码.它是仅在管理员已知的应用程序中需要配置的交换服务器的密码.

您所需要做的就是正确配置电子邮件设置,并允许用户使用它.不需要个人用户名密码.您甚至可以从不存在的发件人"电子邮件ID发送邮件.

如果需要,请查看此Microsoft Video教程:
使用ASP.NET发送来自网站的电子邮件 [
but the customers who are not ready to give their password.
It''s not the personal passwords that are required. It''s the password of exchange server that you need to configure in your application known to Admins only.

All you need is to configure the email settings properly and allow users to use it. Personal username-passwords not needed. You can even send mails from a ''From'' emailid that does not exists.

If needed, have a look at this Microsoft Video tutorial:
Use ASP.NET to send Email from Website[^]


John的方法是正确的,这是所有站点真正起作用的方法.

例如

John''s way is correct, this is the way all sites work really.

e.g

public void sendmailto_Deal(string from, string to, string body)
{
    MailMessage m = new MailMessage();
    SmtpClient sc = new SmtpClient();
    try
    {
        m.From = new MailAddress("no-reply@yourserver.com");
        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);
    }
}


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

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