MyBB Community Forums

Full Version: PHP Mail not working with MyBB 1.6.8 on Linux Ubuntu using ApacheFriends&PostFix
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I recently installed MyBB forums (version: 1.6.8) on my Linux Ubuntu 12.04 computer's locally hosted webserver. The webserver software is ApacheFriends, which is simply the Apache, PHP, and MySQL installation package. Origionally, the php mailing on MyBB didn't work at all, so I installed postfix (did not do any configuring) and it still does not work. I have one script that I found online to test that your mail() server is working, and it did work, however, the one provided by the wiki does not work. I will include both of these further down the page.

I did attempt to do a mass mail, however, it just remained quened and did not send. I checked the "System Mail Log" under "Tools and Matience," however, it is empty; even after 2 password retrieval attempts and 1 account activation attempt (for testing purposes).

Any thoughts or help would be greatly appreciated, I am as stumped as a log. Thank you Big Grin

Sendmail Script from Internet - sends and appears in my inbox
<?php

/*
DONT FORGET TO DELETE THIS SCRIPT WHEN FINISHED!
*/

ini_set( 'display_errors', 1 );
error_reporting( E_ALL );

$from = '[email protected]';

/*
ini_set( 'SMTP', 'smtp.example.com' );
ini_set( 'SMTP_PORT', 25 );
ini_set( 'sendmail_from', $from );
*/

$server = array(
'HTTP_HOST', 'SERVER_NAME', 'SERVER_ADDR', 'SERVER_PORT',
  'SERVER_ADMIN', 'SERVER_SIGNATURE', 'SERVER_SOFTWARE',
'REMOTE_ADDR', 'DOCUMENT_ROOT', 'REQUEST_URI',
'SCRIPT_NAME', 'SCRIPT_FILENAME',
);

$to = ( isset( $_GET['email'] ) ? $_GET['email'] : FALSE );
$subject = 'Mail Test Successful for ' . $_SERVER['HTTP_HOST'];
$message = '';

if ( ! $to )
{
echo '<strong>Set $_GET[\'email\'].</strong>';
exit;
};

foreach ( $server as $s )
{
$message .= sprintf( '%s: %s', $s, $_SERVER[$s] ) . PHP_EOL;
};

$headers = 'From: ' . $from . PHP_EOL
. 'Reply-To: ' . $from . PHP_EOL
. 'X-Mailer: PHP/' . phpversion();

if ( isset( $_GET['send'] ) && $_GET['send'] === 'true' )
{	
$success = mail( $to, $subject, $message, $headers );
}
else
{
echo '<strong>Set &quot;<a href="./?email=' . $to . '&send=true">'
. './?email=' . $to . '&send=true</a>&quot; to send a test e-mail.</strong>';
};

if ( isset( $success ) )
{	
echo 'E-mail sent to: ' . $to;
echo '<br />';
echo 'Successful mail?: <strong ' . ( $success ? 'style="color:green;">YES' : 'style="color:red;">NO' ) . '</strong>';
}
else
{
echo '<br />';
echo 'E-mail set as: '.$to;
};

echo '<hr />';	
echo '<style> * { font-family: Helvetica, Arial, sans-serif; } th { text-align: left; } td { padding: 3px 5px; } </style>';
echo '<table>';	

foreach ( $server as $s )
{
echo '<tr><th>$_SERVER[\'' . $s . '\']</th><td>' . $_SERVER[$s] . '</td></tr>';
};

echo '</table>';

if ( isset( $success ) )
{
echo '<!--';
var_dump( $success );	
echo '-->';
};
?>

Sendmail Script from MyBB Wiki - says PHP Mail Sent, however, I get nothing in my inbox
<?php
error_reporting(E_ALL);

$to = '[email protected]';
ini_set("sendmail_from", " [email protected] ");
if(mail($to, 'Testing mail', 'This is a mailing test to see if PHP mail works.'))
{
     echo 'Mail was sent by PHP';
}
else
{
     echo 'PHP could not send the mail';
}
?>
Try using the SMTP mail option in MyBB.
I used SMTP and it did work correctly, however, is there any way to get the PHP mail to work? Or do you know of anything I could try to see what the issue is? I would really like to have the PHP mail() abilities for other web applications I am using. Thank you.

PHP Mail Troubleshotting
Browser:
Quote:Mail was sent by PHP

Messages in mail.log for this time interval:
Sep  8 04:32:32 Jesse-Server postfix/pickup[12544]: 3BA602A20589: uid=65534 from=<nobody>
Sep  8 04:32:32 Jesse-Server postfix/cleanup[16523]: 3BA602A20589: message-id=<20120908083232.3BA602A20589@Jesse-Server>
Sep  8 04:32:32 Jesse-Server postfix/qmgr[4448]: 3BA602A20589: from=<[email protected]>, size=406, nrcpt=1 (queue active)
Sep  8 04:32:34 Jesse-Server postfix/smtp[16525]: 3BA602A20589: to=<[email protected]>, relay=mta7.am0.yahoodns.net[98.136.216.26]:25, delay=2.4, delays=0.21/0.01/0.83/1.4, dsn=2.0.0, status=sent (250 ok dirdel)
Sep  8 04:32:34 Jesse-Server postfix/qmgr[4448]: 3BA602A20589: removed