This project is read-only.

Could not connect - Failure sending mail.

Oct 19, 2009 at 5:37 PM

I'm having trouble with the email settings in BlogEngine.NET.

I have my web & blog pages set up on a server which is on a different machine than my mail server.  My mail server is Microsoft Exchange Server.

Although I can configure my (local) email program to access the email using either the domain name or ip address (internal or external ip address) of Exchange Server, neither of these works when I am trying to configure the email settings in BlogEngine.NET.

I get the message "Could not connect - Failure sending mail."

Anyone have any suggestions?

Oct 20, 2009 at 12:24 AM

BE connects to the mail server via normal SMTP.  Make sure your Exchange Server is setup for SMTP, and make sure the SMTP settings you entered are correct.

Oct 20, 2009 at 4:43 PM
BenAmada wrote:

BE connects to the mail server via normal SMTP.  Make sure your Exchange Server is setup for SMTP, and make sure the SMTP settings you entered are correct.

My Exchange Server is set up for SMTP.  I have tested the settings using Outlook Express, which requires POP3 and SMTP parameters to be set up individually (unlike Outlook, which connects directly to Exchange).  It works fine.

I am entering the exact same parameters in the setup page on BE as I did in Outlook Express.  I save them first, then test them.

I have checked my firewall settings to be sure that there is nothing blocking SMTP transmission from one computer to the other.  I can't see anything that would.

I keep getting the same message.

Oct 21, 2009 at 7:55 AM

I don't have Exchange to test with, but fortunately this error you're getting is not specific to BE.  Instead it's an error that it appears quite a lot of other people in the ASP.NET community have received too.  This is 'good' because there's actually a fair number of Google search results for this problem with a number of suggested solutions.

For example, in this post, he has a couple of suggestions including specifying 'DefaultNetworkCredentials' and including the 'exchange server' after the windows username -- @exchange.mycompany.  If you're already specifying a username and password, then I would skip trying to add "DefaultNetworkCredentials".

To see if these suggestions or any of the other ones in the Google search results solve this problem, you can make the changes in the Settings.aspx.cs file in the admin\Pages folder.  There's a function in there named "btnTestSmtp_Click" where the code is sending out the email.  If you need any help implementing any of the suggestions you find, feel free to ask here.

If you can get it working, that'll be great, however, all the other code in BE is using a helper utility in the BE core that sends out the email.  So if it ends up where the solution you find requires the code to be changed, then making the same change in the BE helper utility would be required so it works for all the other emails that are sent out of BE.  Fortunately, there's only one place in the BE core (Utils.cs) that would need to be modified.  The BE core would then need to be re-compiled.  But it's possible the required change is not a change in code, but a change in the settings you're entering.

Oct 28, 2009 at 8:12 PM

With the help of my offsite IT guys, I have found the culprit.

McAfee VirusScan Enterprise!  There is a setting under "Access Protection" which is set to "Prevent mass mailing worms from sending mail".  When this setting is disabled, the email works fine.

The Access Protection has a setting for which exceptions can be made (e.g., "mailscan.exe,, iexplorer.exe telnet.exe, etc.), but I don't know what the name of the executable is to add as an exception in this case.

Can you tell me which program is actually sending the email?

Thanks for your help.

Oct 29, 2009 at 4:52 AM

Good discovery.

I'm not sure what program name the email gets sent out of.  Try a Google search, for instance this one.

Most results, like this one, and this one just report unchecking the option like you did as the solution.  In this thread, the person said it might be aspnet_wp.exe.

Oct 29, 2009 at 2:14 PM

The file to add to Access Protection as the exception is "w3wp.exe".

Everything works fine now.

Thanks again for your help.