I browsed the admin logs and found this...
The system throws an error, whenever sender and recipient email adress are not on my servers...
Quote:The mail server does not understand the RCPT TO command. Reason: 553 5.7.1. Sender address rejected: not owned by user XXXXXX.
Why does mybb not use the email adress as "sender" which is set in the configuration and insert the the "real sender's email" as REPLY-TO email ??? that could avoid the hassle, wouldn't it...
And why does mybb not give ANY feedback after submitting an email ?
I assume you're talking about the Send this Thread to a Friend feature, in which case you can do the following:
1. Open the sendthread.php file in a text editor.
2. Find:
if($mybb->settings['mail_handler'] == 'smtp')
{
$from = $mybb->user['email'];
}
else
{
$from = "{$mybb->user['username']} <{$mybb->user['email']}>";
}
3. Change to:
if($mybb->settings['mail_handler'] == 'smtp')
{
$from = $mybb->settings['adminemail'];
}
else
{
$from = "{$mybb->user['username']} <{$mybb->settings['adminemail']}>";
}
(the second edit technically isn't needed since you're using SMTP, but it won't hurt to change it anyway)
Mhmo, I'm talking about the "Send email to user" feature, where people can send emails to each other.
Funny things is: the error says "Sender address rejected" but it works if the RECEIVER is known to the server as well ... Just when both, sender and receiver are not on the server, the error occurs.
And your code suggestion isn't really good, because it wouldjust insert the user name + admin email as "from" value in the mail ...
the only good thing would be:
from : boardname (admin email)
reply to: username (user email)
return path : return path (return email)
and that for ALL emails sent by the system.
and that requires some changes in the inc/class_mailhandler.php
btw: when user mails to user, the email adresses are given to the mailhandler, but NOT the usernames, which is sort of a bug ? or just a missing feature ?
(2011-09-06, 07:06 PM)TStarGermany Wrote: [ -> ]And your code suggestion isn't really good, because it wouldjust insert the user name + admin email as "from" value in the mail ...
Then, again, you failed to explain what you wanted to do clearly. Because that's exactly what you asked for in the first post.
I just want to fix the messages which are sent out (better: attempted to be sent out) by the mybb system.
When a user sends another user an email, the email header is constructed this way:
from : <fromuseremail>
to : <touseremail>
That's all.
Then the server gives an error:
"The mail server does not understand the RCPT TO command. Reason: 553 5.7.1. Sender address rejected: not owned by user XXXXXX."
Which is understandable, because <"fromuseremail"> is not an email from the forum's own server/domain.
A correctly constructed mailheader woul look like this:
from : boardname <(adminemail)>
to : tousername <(touseremail)>
reply to: fromusername <(fromuseremail)>
return path : boardname <(returnemail)>
and having said that, I'll go and fix the class_mailhandler.php myself now. I just had hoped this was a known flaw in the system, seems I was wrong.
No, it's not a bug. It's just how MyBB works. Typically, you'd have to edit this bit of code:
if($this->return_email)
{
$this->headers .= "Return-Path: {$this->return_email}{$this->delimiter}";
$this->headers .= "Reply-To: {$this->return_email}{$this->delimiter}";
}
elseif($mybb->settings['returnemail'])
{
$this->headers .= "Return-Path: {$mybb->settings['returnemail']}{$this->delimiter}";
$this->headers .= "Reply-To: {$mybb->settings['adminemail']}{$this->delimiter}";
}
else
{
$this->headers .= "Return-Path: {$mybb->settings['adminemail']}{$this->delimiter}";
$this->headers .= "Reply-To: {$mybb->settings['adminemail']}{$this->delimiter}";
}
But you only want to change this for emails sent through the forum by the users, right?
It goes for all emails sent out by the system.
In inc/class_mailhandler.php, the functions build_message and set_common_headers are the ones that need to be adjusted and that's what I'll do.
TStarGermany, can you post this on the dev site tracker so the devs can look at it.
dev.mybb.com
In addition to the mailhandler I think there will have to be some changes in the actual place the functions are called, like for the user to user email the from is actually set in member.php so its set even before going to the mailhandler.
That's true, that stuff is all over the place, a pain to go through.
What exactly shall I post in the "dev site tracker" ?
Post a new issue and set it as a feature, pointing out your suggestion in the description. What you're trying to do here, basically. Then the developers might or might not consider it. Personally, I think this would actually be a good idea.