Support Forum

Post By Email: From/Reply-To Address

CC chris.crabtree
chris.crabtree
Member

So I have PBE configured correctly, I think. Test Mail Server Connection works, and I can create a post via email just fine.

And when a user posts to a forum I am subscribed to, I get the PBE message with the formatting to reply back to the forum.

So far, so good.

But this email is actually coming from the default email for the site (wordpress@mydomain.com), and it seems like the From/Reply-To address should really be the same as the mailbox used to deliver it.

Because when I reply, it’s just going to go to wordpress@mydomain.com and won’t make it back into the forum’s mailbox, and so will never get posted to the forum.

I also had the Forum/Options/Email Settings/EMail Address Settings turned on originally, and while that does let me specify the from address and name for the messages, it also is global like wordpress@mydomain.com, and therefore not forum-specific, and so suffers the same problem.

Does this make sense or am I missing something big here in the configuration?

 

Thanks!

30 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

The important item will be the Reply-To address which, if all goes correctly – shopuld be set to the forum email address. So can you check on that please?

CC chris.crabtree
chris.crabtree
Member

Yes, I just checked. There is no Reply-To in the message headers at all, to any address. When I click Reply, it’s addressing the message back to the global wordpress@mydomain.com address (the From header value).

 

CC chris.crabtree
chris.crabtree
Member

Just to make sure I was looking for the right thing, I checked my email of this very post from the Simple Press Support forums, and sure enough the Reply-To header value is there as expected.

 

MP Mr Papa
Mr Papa
Member

sorry, I dont think you understood Andy’s question…

for each forum, you have to specify the email address to use for post by email… go to forum – forums – manage groups and forums… edit each forum and see what you have in the unique post by email address…  there is one per forum…

and you need to have created that email address to on your server…

more info:  http://codex.simple-press.com/codex/plugins/our-plugins/available-plugins/plugin-post-by-email/

CC chris.crabtree
chris.crabtree
Member

Specifically, the ‘Unqiue Post by Email Address for this forum:’ (sic) setting, right?

Yes, those are set with one mailbox per forum (for the two forums I am testing with), and I believe that the Test Mail Server Connection button in Forum/Options/Email Settings/Post By Email Settings uses at least one of the forum mailboxes to perform its test, doesn’t it?

 

 

MP Mr Papa
Mr Papa
Member

and I assume those email addresses actually exist?

sounds like you might be on shared hosting?  wp uses that default address… you can change it on forum – options – email… to be something better…

CC chris.crabtree
chris.crabtree
Member

Yes, the addresses actually exist. :-)

Hosting on WPEngine, which is sort of shared from what I understand, but not like your typical shared setup. The global email address it is using is actually my domain, so it’s not like a generic address or something.

Anyway, I had already changed the addresses on forum options as you suggest, before I reported this issue.

What else can I check?

 

YS Yellow Swordfish
Yellow Swordfish
Member

I can see no logical reason why the mail header should be missing the reply-to data. The code seems OK ands this is the first report of such a thing.

Do you have any email plugins active or custom changes to the standard WP email routines?

CC chris.crabtree
chris.crabtree
Member

No, I don’t think so. I went through some of the code and tested a few ideas after turning on debug.log.

 

This is interesting. I found the sp_subscriptions_do_post_notification() function in sp-subscriptions-components.php and added a bit of code just after $replyto gets assigned. Logging the output, I saw that $replyto was blank, and so added the forum e-mail lookup. This appears to work on my first test, but surely $replyto would be assigned in this fashion anyway, wouldn’t it?

# let plugins hook into this email by user
$msg = apply_filters(‘sph_subscriptions_notification_email’, $msg, $newpost, $user);

# send the notification
$replyto = apply_filters(‘sph_subscriptions_email_replyto’, ”);

/* <cc20130122 changes> */
error_log(“sp_subscriptions_do_post_notification replyto is {$replyto}n”);
if($replyto == “”)
{
$replyto = spdb_table(SFFORUMS, ‘forum_id=’.$newpost[‘forumid’], ‘forum_email’);
}
error_log(“sp_subscriptions_do_post_notification replyto was blank, now is {$replyto}n”);
/* </cc20130122 changes> */

$subject = apply_filters(‘sph_subscriptions_email_subject’, __(‘Forum Post’, ‘sp-subs’).’ – ‘.get_option(‘blogname’).’: [‘.$topicname.’]’, $newpost, $user);
$email_status = sp_send_email($email, $subject, $msg, $replyto);
if (!$sent && $email_status[0]) $sent = true;

 

debug.log output:

[22-Jan-2013 20:13:09] sp_subscriptions_do_post_notification replyto is

[22-Jan-2013 20:13:09] sp_subscriptions_do_post_notification replyto was blank, now is tech.support.issues@phit-n-phat.mailgun.org

[22-Jan-2013 20:13:09] sp_subscriptions_do_post_notification replyto is

[22-Jan-2013 20:13:09] sp_subscriptions_do_post_notification replyto was blank, now is tech.support.issues@phit-n-phat.mailgun.org

The newly assigned email address is the address defined in forum options.

Also curious, and perhaps related, is the fact that there are four lines logged here like the function is being called twice on a single post.

 

In the email itself, there are also two sets of reply instructions (and has been ever since I’ve been working the issue–it was doing this before I changed any code, in other words).

[– To reply by email insert your text above this line – instructions below –]

[– To reply by email insert your text above this line – instructions below –]

 

So I wonder if it is somehow getting confused by the fact that my account is a forum subscriber, forum moderator, and administrator all at once?

 

Thanks!

CC chris.crabtree
chris.crabtree
Member

Also I wonder if the problem could be related to the $replyto = apply_filters() call. No other code in my installation refers to the tag: ‘sph_subscriptions_email_replyto’ at all, so I wonder if I’m missing a necessary component for $replyto to actually be populated or if somehow this is an incorrect tag?

Not sure–just speculating. I am still very new to PHP and WordPress so I’m very much guessing here.

Thanks!

 

MP Mr Papa
Mr Papa
Member

late to the game, but we do not fill in the replyto field… its an optional field…  most emails are returned to the from field…  you can use replyto to override the standard/default reply address…

so question, do you really mean the replyto?  is the from address the wordpress@yoursite.com?

if so, that would make the question why is the from field not getting the right address…  can you tell me what you have for the fields on forum – options – email settings?

and something else that might be worth testing… grab an smtp plugin for wp and see if that matters… we usually recommend HGK SMTP…

CC chris.crabtree
chris.crabtree
Member

I understand–I would rather the From be from the forum-specific address anyway.

Current Settings

I believe the forum-specific email is set correctly. It’s in the sfforums table in the forum_email column, in the UI, and also the little code test I made picks it up correctly when it sets reply-to.

Here are the settings for Forum/Options/Email settings in this screenshot (password blurred of course):

https://www.evernote.com/shard/s169/sh/7175adeb-07c2-4469-bfec-cacf099426e3/182c334466f1cfdb4bec2b75271eb835

And for the forum itself in this one:

https://www.evernote.com/shard/s169/sh/fafa2b68-3a11-4f08-9e6a-f7d2929d3f16/e057d8c735ada8c674367d42e87c39f1

SMTP Plugin

Open to testing the SMTP plugin, although I’m not sure why it would make any difference. I will try it in a bit.

Code That Sets From?

Finally, my casual trip through the code doesn’t reveal where the From address is being set by either PBE or Subscriptions. If convenient, I’d appreciate a pointer to where it is being set. Knowing that, maybe I can help resolve the issue with some tactical debug logging.

Thanks!

MP Mr Papa
Mr Papa
Member

are those email addresses on the same server?  you are telling sp to generally use an email address of:

corinne@phit-n-phat.com 

but the forums PBE stuff is to use

tech.support.issues@phit-n-phat.mailgun.org

two different domains… just want to make sure they are correct…

as to the from, you will have to look inside wp… we dont send the emails, wp does… so function wp_mail()…  in there you will see it assigning the from as WordPress@yourserver.com…  and slightly later will be these filters

    $phpmailer->From     = apply_filters( ‘wp_mail_from’     , $from_email );
    $phpmailer->FromName = apply_filters( ‘wp_mail_from_name’, $from_name  );

and you will see we hook into this in sp_send_email()

which is probably the reason actually…  just notice on the the forum – options – email settings page, you didnt check the option to use the forum email settings…

 

CC chris.crabtree
chris.crabtree
Member

Ah, that certainly sounds like it could be the problem. :-)

Forgive my apparent blindness, however. I still do not even see the option there. I’m looking at the Forum/Options/Email Settings page, which includes three sections: New User Email, Email Address Settings, and Post By Email Settings.

I don’t see any option on that page that refers to ‘Use forum email settings’.