Solved

ASP.NET / VB.NET mass mailer help (A LEGIT MAILING LIST)

Posted on 2004-08-03
4
482 Views
Last Modified: 2006-11-17
I'm responsible for maintaining the email mailing list for the organization I work for. To subscribe to our mailing list users must sign up via the sign-up page on our website, or check an unchecked box when entering a contest thru our site. We do not share or sell our list to third parties and we give our subscribers multiple ways to unsubscribe. We are in compliance with the CAN-SPAM Act of 2003.

Now that that's out of the way...

We have a mailing list with 2000 names on it. I've made an ASP.NET application with VB.NET that loops thru a datareader and sends out an HTML email to each subscriber. The mail server I'm connecting too is Microsoft Exchange Server 5.5. My code inside the loop looks something like this:

----------------------------------------------------
        While DR.Read

                strEmailAddy = DR("email")
                strCombinedMail = strMailHTML + strMailFooter

                objMM.From = "mailinglist@message.com"
                objMM.To = strEmailAddy
                objMM.Body = strCombinedMail
                objMM.Subject = "News You Can Use"
                objMM.BodyFormat = Mail.MailFormat.Html

                Mail.SmtpMail.SmtpServer = MAILSERVER.NAME.PATH

                Mail.SmtpMail.Send(objMM)

        End While
--------------------------------------------------------

And it works fine. It takes maybe 20-40 minutes to send out a little over 2000 messages.

We have a second mailing list that has almost 45,000 email addresses. If I use the exact same code to loop thru a datareader filled with the 45,000 rows, I get a time out error after 2000-3000 messages are sent.

I'm looking for a solution to this problem. Anything from use a different object to send the emails to code the application with PHP to make an adjustment to Microsoft Exchange server, or code so it can handle that many emails.

Does anyone have experience writing similiar code for an application? How did you do it?

Thank You,
Scott
0
Comment
Question by:sneidig
  • 2
4 Comments
 
LVL 18

Expert Comment

by:tusharashah
ID: 11718627
Since you are sending same mail to every one. Why dont you try to build a single string of Email addresses and Mail a single mail using BCC field.

------------------------------------------------------------------------------------------------------------------------------------
        strEmailAddy = ""
        While DR.Read

>>>          strEmailAddy = strEmailAddy + ";" + DR("email")

        End While
>>>         DR.Close

                strCombinedMail = strMailHTML + strMailFooter

                objMM.From = "mailinglist@message.com"
>>>         objMM.To = ""
>>>         objMM.Bcc = strEmailAddy
                objMM.Body = strCombinedMail
                objMM.Subject = "News You Can Use"
                objMM.BodyFormat = Mail.MailFormat.Html

                Mail.SmtpMail.SmtpServer = MAILSERVER.NAME.PATH

                Mail.SmtpMail.Send(objMM)
------------------------------------------------------------------------------------------------------------------------------------


-tushar
0
 

Author Comment

by:sneidig
ID: 11718759
Thank for the response Tushar.

There are a few reasons we don't want to put the email address(es) in the bcc field.

 - For each email message that gets sent out I can create a unique unsubscribe link in the footer created with the users email address or another unique ID. For exampe the url that gets created may look something like this: http://www.mywebsite.com/news/unsubscribe.aspx?email=pleaseremove@email.com
Then I can pull that email address out of the url when the page loads and I can automatically have that email address unsubscribed from the list.

 - Along the same lines as the point above, if someone chooses to just reply to one of our mailings with the word UNSUBSCRIBE in the subject line, I can look at the from field or the url that was generated for the unsubscribe link and find out exactly what email address to search for in our database and unsubscribe. It doesn't happen very often but I've found, when using the bcc field technique that, people will reply hoping to UNSUBSCRIBE from an address that the mailing wasn't sent too - like the email got forwarded from one account to another and then they replied from the second account. At that point I can't remove them from the list without writing back to ask them if they have another email address and I find that solution to be an inconvenience to our subscribers.

 - I have reason to believe that adding many names to the bcc field of an email increases the file size of the overall email. For instance 100 names in the bcc field may add 20k to the email because those addresses are in the header. I would like to keep the mailer as small as possible.

Thanks for the response though it isn't exactly the ideal solution for my problem.

Scott
0
 

Author Comment

by:sneidig
ID: 11813018
I can't believe that not a single person has ever solved this problem before. Why isn't anyone answering? Was my question poorly worded? I'm still trying to figure out a solution.
0
 
LVL 1

Accepted Solution

by:
Roger3 earned 500 total points
ID: 12088766
Your timeout is due to the page timeout in IIS. The asp page itself is timing out. One solution (don't recommend it) woudl be to up the page timeout for your default website.

A better solution would be to take the code you have written, and write a windows or concole application. What are you using to write your asp pages? What other development tools do you have access to?

Personally, I have written a different solution. I save each piece of the email (to, from, body, title, etc... ) to a table in the database. I have a windows service that grabbs 100 messages at a time, and sends them out. If the smtp.sent is successful, it marks that entry in the database table as 'sent'.

Please post more detail if we have missed the mark.

Roger
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
The viewer will learn how to dynamically set the form action using jQuery.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now