在电子邮件中发送批次c# [英] sending batch in email c#

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

问题描述

任何人都知道我们论坛中的材料或文章

发送批量电子邮件,使用ASP.net c#,存储插入,排队和发送电子邮件的程序。



谢谢,

Sathish



比这更清楚



http://stackoverflow.com/questions/16382194/sending -batch-email-in-c-sharp [ ^ ]

Do any one know the material or an article in our forum to
send batch email, using ASP.net c# , store procedure for inserting, queuing and sending email.

Thanks,
Sathish

More clear than this

http://stackoverflow.com/questions/16382194/sending-batch-email-in-c-sharp[^]

推荐答案

在.Net中发送电子邮件非常简单。我认为一旦你看到它是如何工作的,你会发现很容易理解。您提供的样本中有哪些不清楚的地方?



首先,我会忽略所有的事件处理,你不必进行异步调用。基本的电子邮件逻辑只有几行代码,一旦你开始工作,就可以通过异步和错误处理来扩展它。



在您提供的示例中,首先删除所有错误处理以使其正常工作。我想这可能会让你感到困惑。专注于消息对象以及您需要发送和发送的属性。这应该足以让你开始。也许类似以下内容。



你提供的样本有点奇怪。我不喜欢他们如何进行错误处理,我没有看到web.config设置。但您可以在管理设置下在IIS中进行设置。只需使用IIS GUI配置SmtpClient,默认情况下此SmtpClient代码将使用它。或者您也可以在应用内编写代码。但我发现使用IIS配置它更容易。



Sending an email is pretty simple in .Net. I think you will find it pretty easy to follow once you see how it works. What is not clear in the sample you provided?

To start, I would ignore all of the event handling and you do not have to do an async call. The basic email logic is only a few lines of code and once you get that working, you can extend it with the async and error handling.

In the example you provided, just remove all of the error handling at first to get it to work. I think that might be what is confusing you. Focus on the message object and the properties you need to sent and the send. That should be enough to get you started. Maybe something like the following.

The sample you provided is a bit odd. I don't like how they are doing the error handling and I do not see the web.config settings. But you can set that up in IIS under the administration settings. Just configure the SmtpClient using the IIS GUI and this SmtpClient code will use it by default. Or you can code it from within your app as well. But I find it easier to work with IIS to configure it.

SmtpClient mSmtpClient = new SmtpClient ();
mMailMessage.From = new MailAddress ("no-replay@mycompany.net");
mMailMessage.To = "testyourownemail@test.com";
mMailMessage.Body = message;
mMailMessage.IsBodyHtml = true;
mMailMessage.Priority = MailPriority.Normal;
mMailMessage.Subject = subject;
mSmtpClient.EnableSsl = true;
mSmtpClient.Send (mMailMessage);





这是我用过的一篇非常好的MSDN文章。但是,如果您想在此处粘贴代码并提出问题,请执行此操作。我怀疑你做得比实际更难。



http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.aspx [ ^ ]



试试这个,如果您有问题请告诉我们。我们可以帮助您解决遇到的任何问题。



Here's a pretty good MSDN article that I have used myself. But if you want to paste code here and ask questions, please do so. I suspect you are making it harder than it really is.

http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.aspx[^]

Try this and let us know if you have problems. We can probably help you through any of the problems you encounter.


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

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