[buddypress-trac] [BuddyPress Trac] #7009: New Email Feature Over SMTP failed to sent.
buddypress-trac
noreply at wordpress.org
Mon Apr 11 19:30:34 UTC 2016
#7009: New Email Feature Over SMTP failed to sent.
-------------------------------------------------+-------------------------
Reporter: singhleo | Owner:
Type: defect (bug) | Status: new
Priority: high | Milestone: 2.5.3
Component: API - Emails | Version:
Severity: blocker | Resolution:
Keywords: needs-patch dev-feedback needs- |
testing reporter-feedback |
-------------------------------------------------+-------------------------
Changes (by singhleo):
* milestone: Awaiting Review => 2.5.3
Comment:
@DJPaul
Hi Paul,
Thanks for letting me know that this is taken from wordpress which is
added for multisite. thats make sense now.
after doing more deep debug. i found the victim.
multisite code is fine it has nothing wrong in it which is.
{{{#!php
<?php
function fix_phpmailer_messageid( $phpmailer ) {
$phpmailer->Hostname = get_current_site()->domain;
}
}}}
So what it doing it setting the sub site subdomain to the host. and mail
uses host for right hand part of message id header info.
and what we are doing in buddypress for mail functionality is.
{{{#!php
<?php
public static function get_hostname() {
if ( is_multisite() ) {
return get_current_site()->domain; // From
fix_phpmailer_messageid()
}
return preg_replace( '#^https?://#i', '', bp_get_option(
'home' ) );
}
}}}
So from above code.
return get_current_site()->domain; // From fix_phpmailer_messageid() <--
this line is correct which is taken from multisite setup.
But this line is wrong.
return preg_replace( '#^https?://#i', '', bp_get_option( 'home' ) );
which is returning sub site url with sub paths instead of host.
as host name cannot contain the subsite directory and http://. and in most
cases its subsite.
on wordpress they used get_current_site()->domain which returns the domain
url eg. www.domain.com always even client is using multisite on subdir
instead of subdomains.
so it returns
www.domain.com
even if
sub site url is :-
www.domain.com/subsite1
subsite1.domain.com
So in BuddyPress that function code should be changed to something..
{{{#!php
<?php
public static function get_hostname() {
if ( is_multisite() ) {
return get_current_site()->domain; // From
fix_phpmailer_messageid()
}
$home = bp_get_option( 'home' );
$home = parse_url($home);
return $home["host"];
}
}}}
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7009#comment:3>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list