Click here to Skip to main content
15,893,594 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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[^]
Posted
Comments
[no name] 13-Aug-13 10:19am    
"in our forum", did you search for anything?
ridoy 13-Aug-13 15:59pm    
You're right.probably that stackoverflow link is the one that mentioned the topic.

1 solution

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.

C#
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);


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.
 
Share this answer
 
v2
Comments
ridoy 13-Aug-13 16:00pm    
OP is not asking for that,read it carefully.
Jon "Greg"ory Rothlander 13-Aug-13 16:04pm    
Batch or otherwise, the core of the C# code is the same. If your issues is with the SQL side, use the SQL Job agent to execute any sprocs as needed and have the sproc reach out and execute a webService to submit the emails in batch. The code here would be what you'd build on the webService side. That might be a good way to wire this together if you are struggle with the SQL side. Give some more details and others may be able to provide better answers focusing on your issue. The sample that was mentioned as being the solution but not being clear, that is what I thought he wanted. If not, just provide more details. If you are looking for a pure sproc solution using C#, then that is much different. But it's hard to determine from your posting. More details would help clarify.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900