HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Server Operation (http://www.howtoforge.com/forums/forumdisplay.php?f=5)
-   -   mail from server being blocked? (http://www.howtoforge.com/forums/showthread.php?t=2143)

palkat 19th January 2006 04:17

mail from server being blocked?
 
This is a head scratcher for me, been fighting with this for a while.
I got the ISPconfig on a Suse9.3 install and the Uebimaiu webmail that ISPconfig installed works great email AOL users but we have found that PHP programs like Geeklog and Coppermine Photo Gallery to name a couple can send emails to most all servers and people get the emails from them but not AOL and my brother on roadrunner cable back in NewYork.

I can send emails to AOL and my brother on Roadrunner perfectly and they get all the emails sent directly from the Ubimail webmail on my server but its those pesky php programs they don't get email from.

I have gone round an dround with the developtboth GEEKLOG and COPPERMINE PHOTO GALLERY and now turn to you all for any input/help on this.

Why do the PHP programs seem to get blocked by AOL and roadrunner?

Thanks.

themachine 19th January 2006 06:16

Most likely you are using the "mail()" funtion in PHP. And most likely you are not creating proper email headers. Reference the following:

Code:

<?php

$to = "to@domain.com";
$from = "from@domain.com";
$subject = "Subject Line";
$msg = "Email Content";

$headers = "From: $from\r\n";
$headers .= "Reply-To: $from\r\n";
$headers .= "Return-Path: $from\r\n";

mail ($to,$subject,$msg,$headers);

?>


Its possible that if your emails are not sending with a proper return path then they are being rejected. However AOL can reject emails for whatever reason they choose... and therefore it would be helpful if you could post the *FULL HEADERS* of the email message that is bouncing back. Please turn on *FULL HEADERS* in your email client, and then copy all headers including the bounce error message to the forum and then we can help you further.

palkat 19th January 2006 15:57

THats just it, I don't get anything bounced back either...the messages just seem to vaporize to aol.

falko 19th January 2006 21:11

What about the code that produces the mails? Does it generate full headers? Please post this code here (only the code that generates the emails).

till 19th January 2006 22:38

Please have a look at the mail log and post the lines that appear when you send an email to AOL with the PHP application.

palkat 20th January 2006 00:50

Quote:

Originally Posted by falko
What about the code that produces the mails? Does it generate full headers? Please post this code here (only the code that generates the emails).

Here is the code from one program where it will not deliver to AOL. this is GEEKLOG and the code is to send an article to a person via email.

/**
* This will email new stories in the topics that the user is interested in
*
* In account information the user can specify which topics for which they
* will receive any new article for in a daily digest.
*
* @return void
*/

function COM_emailUserTopics()
{
global $_CONF, $_TABLES, $LANG08, $LANG24;

$subject = strip_tags( $_CONF['site_name'] . $LANG08[30] . strftime( '%Y-%m-%d', time() ));

$authors = array();

// Get users who want stories emailed to them
$usersql = "SELECT username,email,etids,{$_TABLES['users']}.uid AS uuid "
. "FROM {$_TABLES['users']}, {$_TABLES['userindex']} "
. "WHERE {$_TABLES['users']}.uid > 1 AND {$_TABLES['userindex']}.uid = {$_TABLES['users']}.uid AND (etids <> '-') ORDER BY {$_TABLES['users']}.uid";

$users = DB_query( $usersql );
$nrows = DB_numRows( $users );

$lastrun = DB_getItem( $_TABLES['vars'], 'value', "name = 'lastemailedstories'" );

// For each user, pull the stories they want and email it to them
for( $x = 1; $x <= $nrows; $x++ )
{
$U = DB_fetchArray( $users );

$storysql = "SELECT sid,uid,date AS day,title,introtext,bodytext "
. "FROM {$_TABLES['stories']} "
. "WHERE draft_flag = 0 AND date <= NOW() AND date >= '{$lastrun}'";

$topicsql = "SELECT tid FROM {$_TABLES['topics']}"
. COM_getPermSQL( 'WHERE', $U['uuid'] );
$tresult = DB_query( $topicsql );
$trows = DB_numRows( $tresult );

if( $trows == 0 )
{
// this user doesn't seem to have access to any topics ...
continue;
}

$TIDS = array();
for( $i = 1; $i <= $trows; $i++ )
{
$T = DB_fetchArray( $tresult );
$TIDS[] = $T['tid'];
}

if( !empty( $U['etids'] ))
{
$ETIDS = explode( ' ', $U['etids'] );
$TIDS = array_intersect( $TIDS, $ETIDS );
}

if( sizeof( $TIDS ) > 0)
{
$storysql .= " AND (tid IN ('" . implode( "','", $TIDS ) . "'))";
}

$storysql .= COM_getPermSQL( 'AND', $U['uuid'] );
$storysql .= ' ORDER BY featured DESC, date DESC';

$stories = DB_query( $storysql );
$nsrows = DB_numRows( $stories );

if( $nsrows == 0 )
{
// If no new stories where pulled for this user, continue with next
continue;
}

$mailtext = $LANG08[29] . strftime( $_CONF['shortdate'], time() ) . "\n";

for( $y = 0; $y < $nsrows; $y++ )
{
// Loop through stories building the requested email message
$S = DB_fetchArray( $stories );

$mailtext .= "\n------------------------------\n\n";
$mailtext .= "$LANG08[31]: "
. COM_undoSpecialChars( stripslashes( $S['title'] )) . "\n";
if( $_CONF['contributedbyline'] == 1 )
{
if( empty( $authors[$S['uid']] ))
{
$storyauthor = DB_getItem( $_TABLES['users'], 'username', "uid = '{$S['uid']}'" );
$authors[$S['uid']] = $storyauthor;
}
else
{
$storyauthor = $authors[$S['uid']];
}
$mailtext .= "$LANG24[7]: " . $storyauthor . "\n";
}

$mailtext .= "$LANG08[32]: " . strftime( $_CONF['date'], strtotime( $S['day' ])) . "\n\n";

if( $_CONF['emailstorieslength'] > 0 )
{
$storytext = COM_undoSpecialChars( stripslashes( strip_tags( $S['introtext'] )));

if( $_CONF['emailstorieslength'] > 1 )
{
if( strlen( $storytext ) > $_CONF['emailstorieslength'] )
{
$storytext = substr( $storytext, 0, $_CONF['emailstorieslength'] ) . '...';
}
}

$mailtext .= $storytext . "\n\n";
}

$mailtext .= $LANG08[33] . ' ' . COM_buildUrl( $_CONF['site_url']
. '/article.php?story=' . $S['sid'] ) . "\n";
}

$mailtext .= "\n------------------------------\n";
$mailtext .= "\n$LANG08[34]\n";
$mailtext .= "\n------------------------------\n";

$mailto = $U['username'] . ' <' . $U['email'] . '>';

COM_mail( $mailto, $subject, $mailtext );
}

DB_query( "UPDATE {$_TABLES['vars']} SET value = NOW() WHERE name = 'lastemailedstories'" );
}

palkat 20th January 2006 00:54

Quote:

Originally Posted by till
Please have a look at the mail log and post the lines that appear when you send an email to AOL with the PHP application.

Sorry to be lame but i have not touched the server is soo long and not a linux god would you mind if i ask where would i find the mail log on the server?

thanks!

falko 20th January 2006 06:41

Please post the COM_mail() function, that's where the emails seem to be generated.

Quote:

Originally Posted by palkat
Sorry to be lame but i have not touched the server is soo long and not a linux god would you mind if i ask where would i find the mail log on the server?

Somewhere in /var/log.

till 20th January 2006 07:48

Quote:

Originally Posted by palkat
Sorry to be lame but i have not touched the server is soo long and not a linux god would you mind if i ask where would i find the mail log on the server?

The mail log is in the directory /var/log

Depending on your linux distro, it might be named:

/var/log/mail
/var/log/mail.log
/var/log/mail.info

palkat 31st January 2006 23:47

Alright sorry for the dealy here is a log from the /var/log of the "mail" file

Note: the log is of 2 mail messages sent the first one from Coppermine Photo Gallery to my AOL account that does not get the messages. This message should be around the 15:34 time stamp.
the Second message is sent again to the same AOL account but from GEEKLOG bloggin program at 15:37 time frame.

Jan 31 15:34:47 server1 postfix/pickup[22590]: 5764D2AF1A: uid=30 from=<wwwrun> Jan 31 15:34:47 server1 postfix/cleanup[23644]: 5764D2AF1A:
message-id=<20060131223446.5764D2AF1A@server1.example.com>
Jan 31 15:34:47 server1 postfix/qmgr[22591]: 5764D2AF1A:
from=<wwwrun@server1.example.com>, size=2570, nrcpt=1 (queue active) Jan 31 15:34:47 server1 postfix/smtp[23646]: warning: connect to
private/tlsmgr: No such file or directory Jan 31 15:34:48 server1 postfix/smtp[23646]: warning: connect to
private/tlsmgr: No such file or directory Jan 31 15:34:48 server1 postfix/smtp[23646]: warning: problem talking to server private/tlsmgr: No such file or directory Jan 31 15:34:48 server1 postfix/smtp[23646]: warning: no entropy for TLS key
generation: disabling TLS support
Jan 31 15:34:49 server1 postfix/smtp[23646]: 5764D2AF1A:
to=<palkat@aim.com>, relay=mailin-02.mx.aol.com[205.188.155.89], delay=3, status=bounced (host mailin-02.mx.aol.com[205.188.155.89] said: 550 REQUESTED ACTION NOT TAKEN: DNS FAILURE (in reply to MAIL FROM command)) Jan 31 15:34:49 server1 postfix/cleanup[23644]: EAC392AF19:
message-id=<20060131223449.EAC392AF19@server1.example.com>
Jan 31 15:34:49 server1 postfix/qmgr[22591]: 5764D2AF1A: removed Jan 31 15:34:49 server1 postfix/qmgr[22591]: EAC392AF19: from=<>, size=4515,
nrcpt=1 (queue active)
Jan 31 15:34:50 server1 postfix/local[23650]: EAC392AF19:
to=<root@server1.example.com>, orig_to=<wwwrun@server1.example.com>,
relay=local, delay=1, status=sent (delivered to maildir) Jan 31 15:34:50 server1 postfix/qmgr[22591]: EAC392AF19: removed Jan 31 15:36:03 server1 postfix/pickup[22590]: 0398F2AF17: uid=30 from=<wwwrun> Jan 31 15:36:03 server1 postfix/cleanup[23644]: 0398F2AF17:
message-id=<20060131223602.0398F2AF17@server1.example.com>
Jan 31 15:36:03 server1 postfix/qmgr[22591]: 0398F2AF17:
from=<wwwrun@server1.example.com>, size=2570, nrcpt=1 (queue active) Jan 31 15:36:05 server1 postfix/smtp[23646]: 0398F2AF17:
to=<palkat@aim.com>, relay=mailin-01.mx.aol.com[205.188.156.185], delay=3, status=bounced (host mailin-01.mx.aol.com[205.188.156.185] said: 550 REQUESTED ACTION NOT TAKEN: DNS FAILURE (in reply to MAIL FROM command)) Jan 31 15:36:05 server1 postfix/cleanup[23644]: D16DB2AF19:
message-id=<20060131223605.D16DB2AF19@server1.example.com>
Jan 31 15:36:05 server1 postfix/qmgr[22591]: D16DB2AF19: from=<>, size=4517,
nrcpt=1 (queue active)
Jan 31 15:36:05 server1 postfix/qmgr[22591]: 0398F2AF17: removed Jan 31 15:36:06 server1 postfix/local[23650]: D16DB2AF19:
to=<root@server1.example.com>, orig_to=<wwwrun@server1.example.com>,
relay=local, delay=1, status=sent (delivered to maildir) Jan 31 15:36:06 server1 postfix/qmgr[22591]: D16DB2AF19: removed Jan 31 15:36:49 server1 pop3d: Connection, ip=[::ffff:68.35.83.14] Jan 31 15:36:50 server1 pop3d: LOGIN, user=visionscreativematting.com_steve,
ip=[::ffff:68.35.83.14]
Jan 31 15:36:51 server1 pop3d: LOGOUT,
user=visionscreativematting.com_steve, ip=[::ffff:68.35.83.14], top=0, retr=0, time=1 Jan 31 15:37:39 server1 postfix/pickup[22590]: 5C9362AF24: uid=30 from=<wwwrun> Jan 31 15:37:39 server1 postfix/cleanup[23644]: 5C9362AF24:
message-id=<20060131223739.5C9362AF24@server1.example.com>
Jan 31 15:37:39 server1 postfix/qmgr[22591]: 5C9362AF24:
from=<wwwrun@server1.example.com>, size=2070, nrcpt=1 (queue active) Jan 31 15:37:40 server1 postfix/smtp[23646]: 5C9362AF24:
to=<palkat@aim.com>, relay=mailin-04.mx.aol.com[64.12.138.152], delay=1, status=bounced (host mailin-04.mx.aol.com[64.12.138.152] said: 550 REQUESTED ACTION NOT TAKEN: DNS FAILURE (in reply to MAIL FROM command)) Jan 31 15:37:40 server1 postfix/cleanup[23644]: D5D612AF25:
message-id=<20060131223740.D5D612AF25@server1.example.com>
Jan 31 15:37:40 server1 postfix/qmgr[22591]: 5C9362AF24: removed Jan 31 15:37:40 server1 postfix/qmgr[22591]: D5D612AF25: from=<>, size=3947,
nrcpt=1 (queue active)
Jan 31 15:37:41 server1 postfix/local[23650]: D5D612AF25:
to=<root@server1.example.com>, orig_to=<wwwrun@server1.example.com>,
relay=local, delay=1, status=sent (delivered to maildir) Jan 31 15:37:41 server1 postfix/qmgr[22591]: D5D612AF25: removed


All times are GMT +2. The time now is 13:31.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.