Newsletter email issues

Mar 18, 2011 at 2:26 PM
Edited Mar 18, 2011 at 11:09 PM

Where does one start to troubleshoot Newsletter email sending issues?  I have some folks that are signed up for the Newsletter notarizations that claim they are not receiving the notifications.  I have one of my own email address that does not receive the notifications. (jsd43@live.com).  Is there a limit set that only allows a maximum number of emails to be sent?  Thank you.

Edit: To Ben,

I added one of my email addresses to the end of the original Newsletter and did not receive a notification, on Newsletter 2 with just a few addresses listed I received the notification fine.  I think there must be a maximum number of emails it will send. If so can I reset it somehow.

Mar 19, 2011 at 12:34 AM
Edited Mar 19, 2011 at 12:34 AM

Found this message in the logger text file.

Error sending email in SendMailMessage: Failure sending mail. Unable to read data from the transport connection: net_io_connectionclosed.

Coordinator
Mar 19, 2011 at 2:42 AM

I Googled for that error and see a lot of people that have had that error, going back a few years.  But unfortunately, I don't see a definitive solution among the results.  You could look thru the results to see if any of the ideas brought up may apply to you.

Mar 19, 2011 at 12:33 PM
Edited Mar 19, 2011 at 12:51 PM

Thanks Ben, this is really a funny issue, it exists on Newsletter 1 intermittently and not on Newsletter 2 which is working fine.

Do you think it may have something to do with the number of email addresses in Newsletter 1, it contains about 100 email addresses.  Newsletter 2 has about 15 at this time?

Also the error above exists it seems for each email address and not just one line.

Do you think the change in code to send out republished pages may have anything to do with it?  At this point the Newsletter is  not working at all.

Mar 19, 2011 at 1:05 PM

Ben,

I just did a test changing this from true to false and republished the post and it worked.

  private const bool SendEmailsForPages = false;

Maybe I had a space or something in the line, I am changing it back to see what happens.

Mar 19, 2011 at 1:28 PM
Edited Mar 19, 2011 at 1:47 PM

I think I may have the answer to this issue but not the fix Ben.

 I did a test trimming newsletter.xml to 15 addresses and did a test posting and it works.  So there must be a maximum number of email addresses that the Newsletter will send to, is there a way to fix it so it will send to more addresses?

Thank you.

Edit:

After more testing it seems that the Newsletter quits sending after about 40 to 50 email addresses and then starts with the error.

Error sending email in SendMailMessage: Failure sending mail. Unable to read data from the transport connection: net_io_connectionclosed.

 

Coordinator
Mar 20, 2011 at 11:31 AM
Edited Mar 20, 2011 at 10:55 PM

The problem is probably because of one of two problems.  (a) The BE code which sends out the emails asynchronously could be having an issue where it's not using the threads well enough, or (b) the email host you are sending the emails thru could have some type of throttling limit where if you are sending too many emails consecutively, it stops accepting the emails.

We could try adding a short delay between each email being sent out.  But before doing that, try replacing the code PublishableSaved() code in widget.ascx.cs with the code below.  The PublishableSaved() code is the same for both the Newsletter widget and the Newsletter2 widget.  So you can put this code in either widget -- although probably putting it in Newsletter is better since that's the one you are having troubles with.

private static void PublishableSaved(object sender, SavedEventArgs e)
{
	var publishable = (IPublishable)sender;

	if (!GetSendSendNewsletterEmails(publishable.Id))
	{
		return;
	}

	LoadEmails();
	var emails = doc.SelectNodes("emails/email");
	if (emails == null)
	{
		return;
	}

	List<MailMessage> messages = new List<MailMessage>();
	foreach (XmlNode node in emails)
	{
		string address = node.InnerText.Trim();

		if (!Utils.StringIsNullOrWhitespace(address) &&
			Utils.IsEmailValid(address))
		{
			MailMessage message = CreateEmail(publishable);
			message.To.Add(address);
			messages.Add(message);
		}
	}
	if (messages.Count == 0) { return; }

	System.Threading.ThreadPool.QueueUserWorkItem(state =>
		{
			System.Threading.Thread.Sleep(3000);

			foreach (MailMessage message in messages)
			{
				System.Threading.Thread.Sleep(1000);
				Utils.SendMailMessage(message);
			}
		});
}
Mar 20, 2011 at 7:33 PM

Thanks Ben, I swapped out the code you provided, however it does not seem to make any difference in the performance of the Newsletter, it still does not email to all the addresses in the newsletter.xml.

Coordinator
Mar 20, 2011 at 10:57 PM

I just edited the code from my last message, by adding a 1 second delay between each message sent.  So if you get chance, try that to see if makes a difference.  It'll take more time for all the emails to get sent out, so when testing, you might need to get it a bit extra time before determining if all the emails went out.  If you have 100 email addresses, and all of them get sent to, that would be 100 extra seconds for the entire process ... which is less than 2 minutes ... not that bad.  I'm not sure if this 1 second delay will make a difference, but is worth trying.

Mar 21, 2011 at 12:53 AM
Edited Mar 21, 2011 at 1:21 AM

Thanks Ben, this seems to have helped some but there is still something going on with the newsletter, with the new code the first test I only received 1 notification.  I did another test posting with the following results:

I am using 4 of my email addresses for the test, they are all current working email addresses all forwarded to the number 1 address which is my main address that I check frequently, it did take about 10 minutes for all of them to arrive, probably due to the forwarding.

Number 1 = received sucessfully

Number 92 = received sucessfully

Number 105 = received sucessfully

Number 130 = not received

There are 131 email addresses in the newsletter.xml file.

Edit:

I just received this form hosting support which may be causing the issues.

Please note that for security and reliability reasons, we do not allow sending more than 100 emails per hour from our shared email server not exceeding a total of 1200 emails per day.

Coordinator
Mar 21, 2011 at 11:27 AM

That's good information.  It probably is them that is throttling or limiting the amount of emails.

The easiest solution is to use a different mail server that allows more per hour -- even a free Gmail account which does have some sending limitations would probably still be sufficient for your email load (I think the limit is around 500 total per day without any hourly restrictions ... I believe).

An hourly limit like they are imposing is pretty rare.  Usually it's a daily limit and/or monthly limit.

The only other option which is much more involved would be a modified Newsletter widget that had its own email queue that could send out the emails spread out over so many hours.

In this case, considering you're only dealing with a couple hundred email addresses, if it was me, I would probably look for another email server to send these emails thru.

Coordinator
Mar 21, 2011 at 11:37 AM

Another option which may or may not work would be to modify the Newsletter widget so instead of sending 1 email per person .... it would put 20 or 30 or 40 people on each email (I'm not sure what the limit for this is).  Those people could be added in either the To field, CC field or BCC field.  So if you have 150 email addresses, and you put 20 people on each email, that would be 8 actual emails that you are sending out.

The part I'm not sure about is how they count emails.  When you send email thru the shared server, it is a relay server and they send/relay (pass along) the email to the recipients.  In the scenario described above, even though you are only sending 8 emails to the shared server, the shared server needs to send out 1 email to each of those recipients ... 150 total emails.  They either count the emails by looking at how many emails are you sending to the relay server OR they count them by how many emails they are sending out from their server to the final recipients.  I would guess they count them via the latter method (150 emails) rather than the former method (8 emails) ... but you never know.  You could ask them ... not sure if the person who gets your question will understand the question or know the actual answer to it.

Mar 21, 2011 at 1:13 PM
Edited Mar 21, 2011 at 5:29 PM

Would it be possible to send only the Newsletter from a Gmail server and not all the hike forms that are sent by contact@sahcinfo.org?  I guess I am asking if the email info would be put on the Newsletter file and not retrieve it though the settings in the admin control panel?

sahcinfo.org is our domain name, changing everything to send from a Gmail address might be confusing to many.

Edit:

I think Gmail's limit of 500 per day is true if sending from webmail, but as low as 100 if accessing though POP.

Mar 22, 2011 at 5:15 PM

Hi Ben,

Issue seems to be resolved, I signed up with  a smtp relay service for $24.00 per year with 1000 emails allowed per month.  I tried it with the code above and without and it works better with the code.  It closed the connection without the code.

Thanks again for your help.

Jerry

 

Mar 22, 2011 at 5:47 PM

Ben, if you have time could you read this and comment, thanks.

If you're using Sendmail, and just relaying to us you need to look at

> the Sendmail options for "MAX_QUEUE_CHILDREN" - this will limit the

> number of queue runners Sendmail invokes, each queue runner will

> connect once - so a   limit of 5 will limit you to up to 5 simultaneous connections.

>

> If you're going to rely on Sendmail's max queue children setting you

> should also set Sendmail's delivery mode to be 'Queue Only' - this

> will stop the Sendmail that's accepting the mail from your

> application from opening a connection to us itself. Otherwise if you

> have many threads talking to Sendmail, you could end up with many

> more than 5 connected to us.

>

> Sendmail's queue children will be much more efficient sending the

> email than other modes (such as 'interactive'), as they will only

> connect / auth   once - can can send hundreds of mails from the queue

> before requiring a   disconnect / reconnect (and re-authentication).

>

> If you're using Sendmail .mc files these setting can be achieved by

> using something like:

>

> define(`confDELIVERY_MODE', `queue')

> define(`confMAX_QUEUE_CHILDREN', `5')

 

I also tried my gmail account and it works great also, guess I could have saved the club $24.00.

Thanks

Coordinator
Mar 23, 2011 at 8:31 AM

It looks like SendMail is this?  The SMTP email component used by the Newsletter widget and by BE is the System.Net.Mail code in the .NET framework.  So you are not using SendMail.  Is SendMail who you paid the money to?  It may be that they offer an optional component to send emails thru to their servers.  Since you're not using the SendMail component, you don't need to worry about those configuration options.

If Gmail works, that might be the better option since it allows you to send 500 emails per day -- where the one you paid for is only 1000 for the entire month.  With Gmail, you could theoretically send out 500 x 30, or 15,000 emails a month.

With the 1,000 per month one, if you have 150 people in your Newsletter list, you could send those emails out up to 6 times a month (6 x 150 = 900).

At least you have options.  Another option is GoDaddy's email services.  I think they might allow up to 1,000 per day.  The cost is around $3 a month or so.  And there are other email services out there too -- probably similar to the one you found.

Mar 23, 2011 at 2:22 PM

Hi Ben,

Is there some code that I can put in the Newsletter.aspx or .cs file that will override the BE email settings and use Gmail or other smpt relay service to send only the Newsletters?

I am asking this because I would like all our hiking schedule/contact forms to continue to use contact@sahc.org.

I was incorrect in the sendmail term, sorry.

Thank you

Coordinator
Mar 24, 2011 at 12:38 PM

The easiest option is to probably copy the code from the the BE core that sends email ... copying it directly into the Newsletter widget, and then calling that code instead of the code in the BE core.  I can paste the code here for that, but don't have the time right now ... I'll take a look in the next day or two.

Apr 2, 2011 at 1:17 PM

I am still having issues with the newsletter, I now have 116 subscribers, I am now trying the Gmail SMTP server and am still having a problem with the newsletter sending all the notifications.  It has no stable results, last night I posted a new post and it sent 53 notifications,this morning a new post sent out 93 notifications.

Coordinator
Apr 3, 2011 at 4:03 AM

Before, I believe you were getting an error message in the logger.txt file.  Are you seeing error messages now related to the newsletter sending process? (in logger.txt).  If so, what error messages are you seeing?

Apr 3, 2011 at 5:22 AM

Here are some of the errors from today:

Date: 01/04/2011 10:36:02 AM
Contents Below
Url : http://sahcinfo.org/page.aspx?id=300604bb-9467-4612-87b1-68cf340897da
Raw Url : /page/eHikes.aspx
Message : Exception of type 'System.Web.HttpUnhandledException' was thrown.
Source : System.Web
StackTrace :    at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at ASP.page_aspx.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
TargetSite : Boolean HandleError(System.Exception)
Message : Object reference not set to an instance of an object.
Source : mscorlib
StackTrace :    at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at App_Code.Controls.WidgetZone.OnInit(EventArgs e)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
TargetSite : Void Insert(TKey, TValue, Boolean)

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/2/2011 5:35:49 AM
Contents Below
Error sending email in SendMailMessage:  Failure sending mail. Thread was being aborted.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/2/2011 1:28:17 PM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.7.0 Temporary System Problem.  Try again later (WS). q29sm1532320yba.2
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/2/2011 1:28:17 PM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.7.0 Temporary System Problem.  Try again later (WS). e24sm3573736ana.2
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/2/2011 1:28:17 PM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.7.0 Temporary System Problem.  Try again later (WS). w6sm3572947anf.6
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/2/2011 1:28:17 PM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.7.0 Temporary System Problem.  Try again later (WS). l29sm1654178yhn.32
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/2/2011 1:28:17 PM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.7.0 Temporary System Problem.  Try again later (WS). x4sm1532488ybl.23
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/2/2011 1:28:17 PM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.7.0 Temporary System Problem.  Try again later (WS). c24sm3571362ana.21
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/2/2011 1:28:17 PM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.7.0 Temporary System Problem.  Try again later (WS). 65sm1652004yhl.85
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/2/2011 1:28:17 PM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.7.0 Temporary System Problem.  Try again later (WS). p41sm878512ybk.14
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/2/2011 1:28:17 PM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.7.0 Temporary System Problem.  Try again later (WS). k16sm124934anb.11
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/2/2011 1:28:17 PM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.7.0 Temporary System Problem.  Try again later (WS). v35sm878025yba.19
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/2/2011 1:28:17 PM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.7.0 Temporary System Problem.  Try again later (WS). e24sm3570224ana.28
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/2/2011 1:28:17 PM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.7.0 Temporary System Problem.  Try again later (WS). x50sm1655202yhc.18
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/2/2011 1:28:18 PM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.7.0 Temporary System Problem.  Try again later (WS). 7sm1655520yhl.19
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/2/2011 1:28:18 PM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.7.0 Temporary System Problem.  Try again later (WS). h30sm726166yhm.6
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/2/2011 1:28:18 PM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.7.0 Temporary System Problem.  Try again later (WS). x65sm1653190yhn.67
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/2/2011 1:28:18 PM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.7.0 Temporary System Problem.  Try again later (WS). c21sm1433946anc.14
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/2/2011 1:28:18 PM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.7.0 Temporary System Problem.  Try again later (WS). 27sm1655038yhl.25
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/2/2011 1:28:18 PM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.7.0 Temporary System Problem.  Try again later (WS). u29sm1654209yhn.69
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/2/2011 1:28:18 PM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.7.0 Temporary System Problem.  Try again later (WS). q29sm1532669ybk.25
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/2/2011 1:28:18 PM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.7.0 Temporary System Problem.  Try again later (WS). p23sm879177ybk.9
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/2/2011 1:28:18 PM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.7.0 Temporary System Problem.  Try again later (WS). v15sm1532215ybk.21
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/2/2011 1:28:18 PM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.7.0 Temporary System Problem.  Try again later (WS). c17sm3568739anc.41
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/2/2011 1:30:22 PM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.7.0 Try again later, closing connection. (MAIL) c38sm3570988anc.44
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/2/2011 1:30:24 PM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.7.0 Try again later, closing connection. (MAIL) f32sm1655716yhc.28
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

Coordinator
Apr 3, 2011 at 7:06 AM

It looks like that error message has been reported by some others relaying email thru Gmail.  For example this one.

My guess is that Gmail has some limitations on sending too many emails in a short period of time.

So you might want to revert back to the other service you paid for.

Coordinator
Apr 3, 2011 at 8:52 AM

... in addition to above comments, I noticed in your log that a lot of the error messages are occurring during the same second.  If you're not already doing so, I would use that code I posted above, specifically the part containing:

System.Threading.Thread.Sleep(1000);

This will put a 1 second delay between each email.  Based on the log, it looks like that line of code may not be there since I see 8 or so of these error messages in the same second.

Depending on the limitations they have setup, it may be that trying to send too many in a very short amount of time is one of their restrictions.  For example, you might be able to send 30 per minute, but not 100 per minute.  You could even try increasing that pause between emails from 1000 (that's 1000 milliseconds or 1 second) to a number like 3000, which would be 3 seconds between each email.

Apr 3, 2011 at 1:21 PM

Hi Ben,

This is the code that is in the .cs, I am thinking maybe it may be something else also going on because the first post that only sent 53 was the first post of the day and the first email that was sent out other then a few scheduled hikes, nowhere close to a 100, maybe 60 at the most.  Then the next post later in the day sent out 93.

 private static string FormatBodyMail(IPublishable publishable)
        {
            var body = new StringBuilder();
            var urlbase = Path.Combine(
                Path.Combine(Utils.AbsoluteWebRoot.AbsoluteUri, "themes"), BlogSettings.Instance.Theme);
            var filePath = string.Format("~/themes/{0}/newsletter.html", BlogSettings.Instance.Theme);
            filePath = HostingEnvironment.MapPath(filePath);
            if (File.Exists(filePath))
            {
                body.Append(File.ReadAllText(filePath));
            }
            else
            {
                // if custom theme doesn't have email template
                // use email template from standard theme
                filePath = HostingEnvironment.MapPath("~/themes/Standard/newsletter.html");
                if (File.Exists(filePath))
                {
                    body.Append(File.ReadAllText(filePath));
                }
                else
                {
                    Utils.Log(
                        "When sending newsletter, newsletter.html does not exist " +
                        "in theme folder, and does not exist in the Standard theme " +
                        "folder.");
                }
            }

            body = body.Replace("[TITLE]", publishable.Title);
            body = body.Replace("[LINK]", publishable.AbsoluteLink.AbsoluteUri);
            body = body.Replace("[LINK_DESCRIPTION]", publishable.Description);
            body = body.Replace("[WebRoot]", Utils.AbsoluteWebRoot.AbsoluteUri);
            body = body.Replace("[httpBase]", urlbase);
            return body.ToString();
        }

        /// 
        /// Gets the send newsletters context data.
        /// 
        /// 
        /// A dictionary.
        /// 
        private static Dictionary GetSendNewslettersContextData()
        {
            const string SendNewsletterEmailsContextItemKey = "SendNewsletterEmails";
            Dictionary data;

            if (HttpContext.Current.Items.Contains(SendNewsletterEmailsContextItemKey))
            {
                data = HttpContext.Current.Items[SendNewsletterEmailsContextItemKey] as Dictionary;
            }
            else
            {
                data = new Dictionary();
                HttpContext.Current.Items[SendNewsletterEmailsContextItemKey] = data;
            }

            return data;
        }

        /// 
        /// Gets the send send newsletter emails.
        /// 
        /// <param name="publishableId" />
        /// The publishableId id.
        /// 
        /// 
        /// Whether send newsletter emails.
        /// 
        private static bool GetSendSendNewsletterEmails(Guid publishableId)
        {
            var data = GetSendNewslettersContextData();

            return data.ContainsKey(publishableId) && data[publishableId];
        }

        /// 
        /// Loads the emails.
        /// 
        private static void LoadEmails()
        {
            if (doc != null && fileName != null)
            {
                return;
            }

            fileName = Path.Combine(BlogSettings.Instance.StorageLocation, "newsletter.xml");
            fileName = HostingEnvironment.MapPath(fileName);

            if (File.Exists(fileName))
            {
                doc = new XmlDocument();
                doc.Load(fileName);
            }
            else
            {
                doc = new XmlDocument();
                doc.LoadXml("");
            }
        }

        /// 
        /// Handles the Saved event of the Publishable.
        /// 
        /// <param name="sender" />
        /// The source of the event.
        /// 
        /// <param name="e" />
        /// The  instance containing the event data.
        /// 
        private static void PublishableSaved(object sender, SavedEventArgs e)
        {
            var publishable = (IPublishable)sender;

            if (!GetSendSendNewsletterEmails(publishable.Id))
            {
                return;
            }

            LoadEmails();
            var emails = doc.SelectNodes("emails/email");
            if (emails == null)
            {
                return;
            }

            List messages = new List();
            foreach (XmlNode node in emails)
            {
                string address = node.InnerText.Trim();

                if (!Utils.StringIsNullOrWhitespace(address) &&
                    Utils.IsEmailValid(address))
                {
                    MailMessage message = CreateEmail(publishable);
                    message.To.Add(address);
                    messages.Add(message);
                }
            }
            if (messages.Count == 0) { return; }

            System.Threading.ThreadPool.QueueUserWorkItem(state =>
            {
                System.Threading.Thread.Sleep(3000);

                foreach (MailMessage message in messages)
                {
                    System.Threading.Thread.Sleep(1000);
                    Utils.SendMailMessage(message);
                }
            });
        }

 

 

 

Apr 3, 2011 at 1:30 PM

Would this error reveal anything?

Date: 4/2/2011 4:36:44 PM
Contents Below
Url : http://www.sahcinfo.org/Default.aspx
Raw Url : /
Message : Exception of type 'System.Web.HttpUnhandledException' was thrown.
Source : System.Web
StackTrace :    at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at ASP.default_aspx.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
TargetSite : Boolean HandleError(System.Exception)
Message : Object reference not set to an instance of an object.
Source : mscorlib
StackTrace :    at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at App_Code.Controls.WidgetZone.OnInit(EventArgs e)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
TargetSite : Void Insert(TKey, TValue, Boolean)

Apr 3, 2011 at 2:03 PM
Edited Apr 3, 2011 at 8:19 PM

Update:

I changed the code to Sleep 3000 and the first post of the day sent to all 115 subscribers, I will keep checking on posts sent.

Update:

The 2nd post of the day only sent out 23 notifications, and there are no new errors in the logger.txt.  This is a very strange situation.

Apr 5, 2011 at 12:29 AM

First post of today sent out only 58 notifications.

Coordinator
Apr 5, 2011 at 1:45 AM

Are there any error messages this time?  I think you didn't have any error messages yesterday on your 2nd post, after 23 successfully sent out.

You might want to consider trying a different email service like GoDaddy.
http://www.godaddy.com/email/email-hosting.aspx

You could get the Personal one where you get 1 email address and it's $1.19 a month.  According to "How many email messages can I send per day?", you get 250 SMTP relays (emails) per day per email account.  If you need more, they allow you to purchase additional blocks of SMTP emails per day.  It's a relatively inexpensive experiment.  I think you have to buy 1 year's worth up front, but then if you cancel, they will do a prorated refund.

Apr 5, 2011 at 5:06 AM
Edited Apr 5, 2011 at 5:09 AM

No error in reference to email, just this:

Date: 04.04.2011 20:37:43Contents BelowUrl : http://sahcinfo.org/Default.aspxRaw Url : /Message : Exception of type 'System.Web.HttpUnhandledException' was thrown.Source : System.WebStackTrace :    at System.Web.UI.Page.HandleError(Exception e)   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)   at System.Web.UI.Page.ProcessRequest()   at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)   at System.Web.UI.Page.ProcessRequest(HttpContext context)   at ASP.default_aspx.ProcessRequest(HttpContext context)   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)TargetSite : Boolean HandleError(System.Exception)Message : Object reference not set to an instance of an object.Source : mscorlibStackTrace :    at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)   at App_Code.Controls.WidgetZone.OnInit(EventArgs e)   at System.Web.UI.Control.InitRecursive(Control namingContainer)   at System.Web.UI.Control.InitRecursive(Control namingContainer)   at System.Web.UI.Control.InitRecursive(Control namingContainer)   at System.Web.UI.Control.InitRecursive(Control namingContainer)   at System.Web.UI.Control.InitRecursive(Control namingContainer)   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)TargetSite : Void Insert(TKey, TValue, Boolean)

I am testing the SMTP server package I purchased and see how it works.

I'll also check out GoDaddy.

Thanks

Update: GoDaddy has a 250 per day limit on their SMTP relays.

Coordinator
Apr 5, 2011 at 12:58 PM

That error looks unrelated.  Btw, how are you confirming not all the recipients are getting the newsletter email?  I imagine you are probably somewhere in the list (maybe a few places including the bottom).  So maybe you're checking that way.

One thing you can do is log when an email IS sent (the opposite of when an error occurs during the sending of an email).

You currently have this line of code:

Utils.SendMailMessage(message);

Replace that single line with:

string sendMailErrorMsg = Utils.SendMailMessage(message);

string logMsg = null;
if (string.IsNullOrEmpty(sendMailErrorMsg))
	logMsg = string.Format("Newsletter email successfully sent to {0}.", message.To[0].Address);
else
	logMsg = string.Format("Newsletter email FAILED to {0}.  Error message: {1}", message.To[0].Address, sendMailErrorMsg);

Utils.Log(logMsg);

This will add a log record into the logger.txt file for each email attempt.  You can see that if an error occurs that it'll say FAILED and output the error message, although SendMailMessage() itself already logs the error message.  So if an email fails, you'll probably see 2 error messages in a row.  If for some reason the email sending process just "stops", you'll be able to tell that too since there won't be any log records (or they will stop at a certain point).

I would continue using the delay between emails -- via System.Threading.Thread.Sleep(1000); or use a larger number for a larger delay.

Apr 5, 2011 at 1:31 PM

Hi Ben,

I am checking 2 ways for unsent messages, I am the first and lastt one on the list using different addresses and also I logged into the gmail account and looked at messages sent. 

I have the sleep at 3000.

I'll insert the code above and report back on the next post.

Thank you.

Apr 5, 2011 at 1:42 PM

I have searched the newsletter.cs for 

Utils.SendMailMessage(message); but cannot find it.
Coordinator
Apr 5, 2011 at 2:08 PM

I'm not sure what code you are using, but the code I posted on March 20th in this message thread has that line of code in it.  I think you were using that code at one point.  The code is in widget.ascx.cs of the Newsletter widget.

Because I'm using the mail sending classes in .NET before to send out between 300 - 500 emails at a time without any problems (in a non-BE project), I feel confident that the built-in mail sending classes in .NET work well.

The two possible causes I can think of for this are either some code flaw in BE, or the mail server is not liking that many emails to be sent in such a short amount of time.  The shared hosting where I've sent out 300 - 500 emails at a time asks that you don't send out more than 500 at a time (although I think I've actually gone over that), and they do have a monthly limit, but it's a pretty high limit.  That shared web host is this one CrystalTech, btw.  I'm not necessarily recommending them, but just saying they don't have any showstopping email limitations on only being able to send out no more than 100 emails per hour like the limitation your web host has, for example.

I haven't sent out a large number of emails with BE, so I can't completely rule out a problem with it ... although the code seems to check out.

Coordinator
Apr 5, 2011 at 2:14 PM

If you'd like, I can setup a temporary email account under my allben.net domain name (for example, sahcinfo at allben dot net), and I can give you a password for it, and you can temporarily change your email settings in BE to that account, and write a post so the newsletter sends out an email to everyone in your list, to see if it works under that account.  The mail server for allben is at CrystalTech.

Apr 5, 2011 at 2:19 PM
Edited Apr 5, 2011 at 2:21 PM

You are correct I found it and replaced the code, strange when I did a search it didn't find it.

So far I have tried my hosters SMTP, they have the hourly restrictions, I then tried the vendor's SMTP, then Gmail's, I am now back on the vendors. they also have a control panel that I can check for errors.

I am actually not sending that many emails in a short time frame, yesterday the first post was the only one in over a 24 hour period.

Thanks for the CrystalTech link, I will check that out if I cannot get it working, I hate to think about changing hosts again though, it is a bit of a hassle and I have to get it approved by the hiking club board.

Thanks for your continued help Ben

Edit"

if (string.IsNullOrEmpty(sendMailErrorMsg)) has the red squiggly lines and says does not exist in the current context, does that matter?

Apr 5, 2011 at 8:19 PM

Errors from today with new code.

Date: 4/5/2011 9:17:09 AM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.3.2 Too many open connections.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:17:09 AM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.3.2 Too many open connections.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:17:09 AM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.3.2 Too many open connections.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:17:09 AM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.3.2 Too many open connections.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:17:09 AM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.3.2 Too many open connections.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:17:09 AM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.3.2 Too many open connections.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:17:09 AM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.3.2 Too many open connections.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:17:09 AM
Contents Below
Error sending email in SendMailMessage:  Service not available, closing transmission channel. The server response was: 4.3.2 Too many open connections.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:18:49 AM
Contents Below
Error sending email in SendMailMessage:  The operation has timed out.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:18:49 AM
Contents Below
Error sending email in SendMailMessage:  The operation has timed out.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:18:49 AM
Contents Below
Error sending email in SendMailMessage:  The operation has timed out.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:18:49 AM
Contents Below
Error sending email in SendMailMessage:  The operation has timed out.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:18:49 AM
Contents Below
Error sending email in SendMailMessage:  The operation has timed out.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:18:49 AM
Contents Below
Error sending email in SendMailMessage:  The operation has timed out.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:18:49 AM
Contents Below
Error sending email in SendMailMessage:  The operation has timed out.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:18:49 AM
Contents Below
Error sending email in SendMailMessage:  The operation has timed out.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:18:49 AM
Contents Below
Error sending email in SendMailMessage:  The operation has timed out.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:18:49 AM
Contents Below
Error sending email in SendMailMessage:  The operation has timed out.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:18:49 AM
Contents Below
Error sending email in SendMailMessage:  The operation has timed out.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:18:49 AM
Contents Below
Error sending email in SendMailMessage:  The operation has timed out.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:18:49 AM
Contents Below
Error sending email in SendMailMessage:  The operation has timed out.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:18:49 AM
Contents Below
Error sending email in SendMailMessage:  The operation has timed out.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:18:49 AM
Contents Below
Error sending email in SendMailMessage:  The operation has timed out.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:18:49 AM
Contents Below
Error sending email in SendMailMessage:  The operation has timed out.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:18:49 AM
Contents Below
Error sending email in SendMailMessage:  The operation has timed out.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:18:49 AM
Contents Below
Error sending email in SendMailMessage:  The operation has timed out.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Date: 4/5/2011 9:18:49 AM
Contents Below
Error sending email in SendMailMessage:  The operation has timed out.

Apr 5, 2011 at 8:54 PM

Thank you Ben, I could give it a try and see what happens.

Coordinator
Apr 6, 2011 at 1:31 PM

I sent an email to your gmail account with the account information.  Fingers are crossed.

Apr 6, 2011 at 9:01 PM
Edited Apr 7, 2011 at 4:45 AM

Thanks Ben,

I set the mail settings up and did a test and a contact form test and both were successful.  I'll try a post later today.

Update:

I had to switch the email settings back due to lack of authentication when submitting a hiking form. 

Coordinator
Apr 8, 2011 at 12:49 PM

Before switching back, did you get a chance to create a post that would send out the newsletter using my mail server?

Apr 8, 2011 at 3:35 PM

I did not have time Ben because the hike deadline was due and we had a lot of hiking forms that were sent and I received notices from several guides that they were not getting confirmation of forms sent, I did a test hike submit and at the top the error that relay authentication was needed.  I will change it back and do a post check as soon as I can.

Apr 11, 2011 at 2:29 PM

This morning I sent out an eHike post which would include Newsletter 1 and Newsletter 2, 1 has 112 addresses, 2 has 39.  The eHike post sent out a total of 123.

Post number 2 was a regular post and it sent out 100%

Post number 3 was a regular post and only sent out 40

I found no error in logger.test pertaining to emails.

I am using the paid SMTP relay server and there are no errors reported there, I upgraded to 2000 emails per month so I am sure we can rule out any quantity issues/

However I must mention something that occurred to me Ben, when you first made Newsletter 2 for me and I said I could not get it to work you said that you though I was using BE 2.0 which I was, then you made another Newsletter 2 and it worked.  I am thinging that when I upgraded to Be 2 I may not have gotten everything correct, maybe there is some old files in there causing an issue.

The only thing I can think of to do is try the setup with a newer clean release, I have it setup up on a test site and it seems to be working, maybe I will just point the domain to it and see what happens on a post.  I think I have the correct newsletter 2 configured on it, is there an easy way for me to check?  Do you think having 2 Newsletters may be causing the issues?

Any ideas?

Apr 11, 2011 at 9:30 PM

Latest post with the latest BE source code only sent out 25 emails with no errors in the logger.txt,.

At this point in time I am thinking maybe I should just delete both the Newsletter widgets as they do not seem to work for me, unfortunately they are a much desired addition to the website.

I cannot think of any other testing to do.

Apr 11, 2011 at 11:15 PM
Edited Apr 11, 2011 at 11:45 PM

Latest test with your mail settings Ben, although after logging in it seems that SmarterMail does not actually have a sent box, to see the actual messages sent, but after checking the Reports I saw that it had sent 114 messages, so I am assuming that it did send all the emails out.  My name is 110 on the list and I did receive mine, there are 114 addresses on the list.

Edit:

I also received this from the paid SMTP server support.

Hi,

I've briefly spoken to one of our on call engineers - they've looked at what your system is doing, and it appears it's opening *lots* of simultaneous connections.

It also appears that the software you're using is ignoring the '421 too many connections' warnings that our servers send back when your system has opened too many connections - and treating that instead as an error for the email. This could be causing your problem.

Does the software you're using have somewhere you can set the maximum number of simultaneous connections? (This may also be called the 'maximum number of threads'?)

It appears it doesn't handle the error/warning we're sending back very well - if it has a setting for the above, and you can try changing it to something lower such as 5 to start off with, that may fix the problem.

AuthSMTP Support

Coordinator
Apr 12, 2011 at 12:42 PM

Regarding multiple connections to the mail server, the newsletter widget that is included with BE may create multiple connections to the mail server ... sending multiples emails at once to the server (i.e. in parallel).  I'm not 100% sure if this is in fact what happens, but because multiple threads are being created, it's conceivable that multiple connections to the mail server are occurring simultaneously.

The updated code I posted in this message thread on March 20th works differently, and should only send 1 email at a time ... rather than opening multiple connections at once.

I think you're using both Newsletter widgets (Newsletter and Newsletter2).  I would check which code each of those widgets is using.  The March 20th code from this message thread is preferable.  The code I posted here on March 20th can be used for both Newsletter widgets as that portion of code is the same for both widgets (the "PublishableSaved" code).

I'll probably update the Newsletter widget in the BE codebase, so it uses that March 20th code.

Apr 12, 2011 at 1:37 PM

Response from vendors support.

We have taken a look at the BlogEngine 2.0 application code for you and there is no obvious way to configure a limit on the number of simultaneous connections that can be opened at once without re-writing core sections of the code that sends the email.

The limit on the number of simultaneous connections is to prevent a single customer using excessive resources on our systems, that default limit of 5 connections is very rarely an issue and is more than sufficient to send many emails in a very short time scale on one connection alone.

We can't really comment on your friends email setup because we don't know the details of how that was setup but if it was opening a connection for every single email all at the same time it may well have worked but if you were to continue doing that on a regular basis it is highly likely the host of the machine would either block you from doing that or contact you to advise that you would need to change the way it is setup.

The BlogEngine application is working correctly and our system is accepting the messages as it should do but the issue is that BlogEngine is not correctly handling the errors that are being returned because of too many connections and it does not offer a way of limiting the number of connections or delaying messages so that it does not try to send them all at the same time each on their own connection.

We would recommend that you contact the vendors of BlogEngine 2.0 and raise this issue with them, they should be able to offer you advice and / or a solution to get the software working as it should do.

Thank you... AuthSMTP Support

Apr 12, 2011 at 2:45 PM
Edited Apr 12, 2011 at 3:37 PM

I have the 3/20 code in the Newsletter and that's the one that is having the connection issues.  Edit: my error, the code was not in the new release website,.

I am wondering why it worked flawlessly on the temp server you provided me, maybe because they allow 800 per hour, NOTE: The 3/20 code was not in the .cs file for this test.

See above for latest from vendor.

Coordinator
Apr 13, 2011 at 1:22 PM

I would then suggest using the 3/20 code for both of your Newsletter widgets.  It *should* make it so only one message is sent to the mail server at a time.

And you can of course optionally use that delay via System.Threading.Thread.Sleep() to introduce a small delay between each email sent (I think you've been using the delay).

Apr 13, 2011 at 2:44 PM

Any thoughts on this Ben?

I am wondering why it worked flawlessly on the temp server you provided me, maybe because they allow 800 per hour, NOTE: The 3/20 code was not in the .cs file for this test.

Coordinator
Apr 15, 2011 at 1:04 PM

The newsletter widget can still probably successfully send out all the emails even without the 3/20 code.  Many people are using the Newsletter widget that doesn't contain the 3/20 code and their email are going out.  Although depending on how many people they are sending an email to and depending on their mail server setup/limitations, there are probably cases where not all the emails are going out (and the people don't realize it).

The 3/20 code is probably safer since it doesn't send multiple emails simultaneously ... it sends one after another.

If the email host you tried sending emails thru said that you were sending too many simultaneous emails (which is what they said) and you were not using the 3/20 code, it would definitely be a good idea to switch to the 3/20 code which should solve that particular problem their server was unhappy about.