This project is read-only.

System email address

Oct 26, 2010 at 12:10 AM

In testing v1.6.1 on SQL Server, I noticed that under Admin > Settings, the only email address (as the system sender) that works is my own.  If I put on in there that I want, such as noreply@<our domain>, it doesn't send the email but no errors are generated.  So that suggests it uses pass through authentication for our mail server.  Is this the case?  If so, is there an option anywhere to turn off pass through authentication?

Please help!

Oct 26, 2010 at 2:06 AM

Yes, there's just the one email address.  The email address you enter in there will be the From address.  There's also the username/password fields if you need to use SMTP authentication.

I'm actually not sure what you mean by pass through authentication -- maybe you mean SMTP authentication?  Or I'm just not familiar with the term.

There's nothing fancy going on however with the mail sending.  It uses SMTP to send.  Whatever information you enter in there will work the same way as it would if you enter the same information into a normal email client.

Oct 26, 2010 at 2:09 AM

Also, depending on your mail server, it may be required that the From address be a real email address.  If noreply isn't a valid email account, then it may be rejecting the emails.  I've seen this before.  Can you send email with that "noreply" address as the FROM account when using an email client like Windows Mail, Thunderbird, etc?

Oct 26, 2010 at 5:49 PM

Ben, thanks for replying.

We are on Exchange server here and we host our own website, so everything is internal to our network.  Pass through authentication is where Exchange uses the credentials used to log into your machine for authentication.  Since I am testing this on a dev server that I logged into with my credentials it is most likely using pass through since no other email address works.

In thinking about it, it may not be BlogEngine, it may just be our mail server.  However, I've tried other domain account email addresses to no avail.  What I'd like is to have something like "noreply" as the BlogEngine system "from" address instead of a real domain account.  I'll play around with it some more and try a couple more things.

On another note, can an author have more than one email address so that if someone posts a comment, the notification email is sent to both email accounts?

Oct 27, 2010 at 6:04 AM

You can send comment notification emails to different or multiple email addresses.

See this post (probably the Oct 2nd message by me).  Each user has a profile (Profiles tab).  You can enter an email address in there for each user.  That code will lookup the Profile by author, and send the email to the email address registered in the profile.  It could be easily tweaked to also send out an email to the main email address on the Settings tab (BlogSettings.Instance.Email), and/or any other email address.  You can add one or more email addresses for the "TO" by calling mail.To.Add() once for each email address.

Oct 28, 2010 at 11:07 PM

Ben, I'm still having that issue with the system sender email address.  Under Settings > Email, the only address that works is mine.  I've tried noreply@<ourdomain> (preferred), and I've tried a few other legitimate domain users but nothing else works.  The comment notification email just doesn't get sent.  No errors, nothing.  I tried running it in debug mode as well and it runs fine but not mail sent unless it's my address in there. 

Any other thoughts?  Thanks.

Oct 28, 2010 at 11:19 PM

Have you tried the "Test" button on the Settings tab -- i.e. the place where you enter your Email settings.  Does that work?  Did you step thru the code there, and it sends correctly?  But you don't receive the email ?

There's nothing hard coded in BE that dislikes your other domain users and only likes you :)

So if your email address works, but nobody elses does, it seems like very likely that there is some difference between your Exchange account and the other people's Exchange accounts.

I haven't used Exchange before, so am not up to speed with how it works.  But I know there are BE users who use Exchange.

Oct 28, 2010 at 11:30 PM

Yes, I've tried the "Test" button and it always comes back successful but the email isn't actually sent unless my address is in there.  I know it's pretty weird, huh?  And stepping through the code looks like it all works fine.  This leads me to believe it might be something on our Exchange server but my account is no different than anybody else's in Exchange.

Also, thanks for verifying that there's no code in BE that only likes me, as I looked all through the code and couldn't find any. :)

I think what I'll test next is to log onto my machine as a different user, keeping my email address in the settings and seeing if the email gets sent.  This would test the "pass through authentication" theory.  I'll let you know how it goes and if you think of something else, I'm all ears.

Thanks again.

Oct 28, 2010 at 11:41 PM

No difference.  It was a dumb idea anyway.  Our website sends out emails using that same "noreply" address as the sender without a problem and it's in ASP.NET as well.  I'm at a loss at this point.

Oct 29, 2010 at 10:55 PM
Edited Oct 29, 2010 at 11:47 PM

Ben, maybe I am not understanding the settings in Settings > Email, but I found out why I've got this issue.  In the file Extensions/SendCommentMail.cs, there are these two lines:



OK, I made a few code changes and now it works like I was expecting it to.  I also found in admin/pages/Settings.aspx.cs the event for the "Test" button on the Setting page and the code there was:

mail.To.Add(mail.From); - no wonder when using noreply it looked like it wasn't working.  I changed that to:

AuthorProfile ap = AuthorProfile.GetProfile("admin");


And in Extensions/SendCommentMail.cs, I changed the code there to:

mail.To.Add(post.AuthorProfile.EmailAddress); - So now when a comment is added to a post, the notification goes to the post author.

So that brings me to another question: When the next version comes out and I upgrade to it, will these changes be lost?




mail.From = new MailAddress(BlogSettings.Instance.Email);

This is why when I used "noreply" as the address it appeared like it didn't work.  It's because the code says to make the sender and recipient the same and that address doesn't really exist!  Only after one of my users (an address I tried that appeared not to work) came to me and said "hey, what's this email all about" did I come to realize what was happening.

It seems that the address in Settings > Email should be considered the "from" address when emails are sent from the system.  Why would the recipient be the same???  Shouldn't the recipient be either the post author and/or the system admin?  That's the behavior I was assuming.

The current behavior seems off to me unless I'm misunderstanding how it's supposed to work.


Oct 31, 2010 at 3:08 AM

Glad you figured that out -- I maybe should have thought of it and explained it.

The reason why its setup so the Email Address is both the From and the To is because traditionally BE has been a single user application.  Multiple editors is not used by most people.  This type of person typically just has their own personal email address.  I suppose an enhancement to this would be to have it where the Email Settings can have a From and To email address.

Although if you have multiple Editors and they have profiles filled out with their email address in the Profile, then doing it like you're doing is probably best (where you send the notification emails directly to the Editor).  This is another situation where filling out a Profile and including your email address in the profile isn't required.  So BE can't rely on that data being there (it could check for it though).  It's nice this capability exists for situations like yours.

When you make changes like you did, if you upgrade to a newer version of BE, you'll need to reimplement the changes you made.  I used to have lots of personal customizations like that, but currently have none ... makes it easier to upgrade.  I probably upgrade more than most people.  It's probably best if you document what changes you made, and then if you upgrade to a newer version of BE someday, you would just reimplement those changes again.