发送匿名电子邮件C# [英] Send anonymous emails C#

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

问题描述

您好我想验证密码发送到使用C#我的用户,我想保护我的邮箱垃圾邮件得到。 ?我该怎么做了。

Hi I want to send password validation to my users using c#, and I wish to protect my mail box getting spammed. How do I do that?

一直在努力这一点,它不工作:

Been trying to this and it's not working:

        SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587);
        smtpClient.EnableSsl = true;

        smtpClient.Timeout = 10000;
        smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
        smtpClient.UseDefaultCredentials = false;
        smtpClient.Credentials = new NetworkCredential("login", "password");

        MailMessage mailMsg = new MailMessage();
        mailMsg.From = new MailAddress("noreply@mysite.com");
        mailMsg.To.Add("user");
        mailMsg.CC.Add("cc@ccServer.com");
        mailMsg.Bcc.Add("bcc@bccServer.com");
        mailMsg.Subject = "Subject";
        mailMsg.Body = "BodyOfTheMailString";
        smtpClient.Send(mailMsg); 
        Console.WriteLine("Mail sent");



我发送这封邮件给,让我的Gmail帐户作为发件人的用户

The user i am sending this email to, getting my gmail account as the sender

推荐答案

这是不是C#的任务,无论是你的邮件正文:这是你的邮箱配置。

This is not C#'s task, neither the body of your message: its your mailbox configuration.

如果这仅仅是电子邮件验证,你总是可以创建一个像service@domain.com或noreply@domain.com一个新的电子邮件发送这些验证消息,然后将该邮箱忽略传入的消息。

If this is just for email validation, you can always create a new email like "service@domain.com" or "noreply@domain.com" for sending these verifications messages and then set this mailbox to ignore incoming messages.

此外,如果您尝试发送使用未注册到服务器的电子邮件信息,该服务器可以拒绝你的要求。

Also if you try to send messages using emails that are not registered into your server, the server can deny your request.

这篇关于发送匿名电子邮件C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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