Forums / Cotonti / Development / SMTP

urlkiller
#25398 2010-07-30 05:43
if you take a look at the code.
this is the regular function to send mails in cotonti.
$headers = (empty($headers)) ? "From: \"".$cfg['maintitle']."\" <".$cfg['adminemail'].">\n"."Reply-To: <".$cfg['adminemail'].">\n" : $headers;

the $cfg['adminemail'] is set somewhere in the system. this is the sender, the server-adress of yours. you could try to fiddle with that function to get the result you want. but remember on a update you need to change the line again...

BUT i have to say that i encounter that problem on some servers too and i didnt find a way yet to fix that. i believe on some server the mail command takes the email adress of the server admin or from the useraccount, not sure here...

functions.php line 3009:
/**
 * Sends mail with standard PHP mail()
 *
 * @global $cfg
 * @param string $fmail Recipient
 * @param string $subject Subject
 * @param string $body Message body
 * @param string $headers Message headers
 * @param string $additional_parameters Additional parameters passed to sendmail
 * @return bool
 */
function sed_mail($fmail, $subject, $body, $headers='', $additional_parameters = null)
{
	global $cfg;

	if(empty($fmail))
	{
		return(FALSE);
	}
	else
	{
		$headers = (empty($headers)) ? "From: \"".$cfg['maintitle']."\" <".$cfg['adminemail'].">\n"."Reply-To: <".$cfg['adminemail'].">\n" : $headers;
		$body .= "\n\n".$cfg['maintitle']." - ".$cfg['mainurl']."\n".$cfg['subtitle'];
		if($cfg['charset'] != 'us-ascii')
		{
			$headers .= "Content-Type: text/plain; charset=".$cfg['charset']."\n";
			$headers .= "Content-Transfer-Encoding: 8bit\n";
			$subject = mb_encode_mimeheader($subject, $cfg['charset'], 'B', "\n");
		}
		if(ini_get('safe_mode'))
		{
			mail($fmail, $subject, $body, $headers);
		}
		else
		{
			mail($fmail, $subject, $body, $headers, $additional_parameters);
		}
		sed_stat_inc('totalmailsent');
		return(TRUE);
	}
}


edit: SMTP-Adress? tz tz tz, read here: http://nl.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol
URL shortener: <a href="http://bbm.li/!7AD5C7">http://bbm.li/!7AD5C7</a>