PDA

Zobacz pełną wersję : Problem z wysyłaniem maili - spf



webxl.pl
22-06-2006, 18:43
Witam meczylem sie z tym problemem jakis czas i w koncu udalo mi sie znalezc rozwiazanie problemow z mailem potwierdzajacym rejestracje uzytkownikow zwlaszcza wysylanych na konta wp.pl ponizej wklejam kod ktory nalezy wstawic zamiast oryginalnego kodu w pliku joomla.php w katalogu /includes
W moim przypadku zmiana ta rozwiazala problem wynikajacy z zabezpieczen SPF uzywanych przez wp.pl czy Yahoo albo msn.


/**
* Mail function (uses phpMailer)
* @param string From e-mail address
* @param string From name
* @param string/array Recipient e-mail address(es)
* @param string E-mail subject
* @param string Message body
* @param boolean false = plain text, true = HTML
* @param string/array CC e-mail address(es)
* @param string/array BCC e-mail address(es)
* @param string/array Attachment file name(s)
* @param string/array ReplyTo e-mail address(es) //BB: ADDED
* @param string/array ReplyTo name(s) //BB: ADDED
*/
function mosMail($from, $fromname, $recipient, $subject, $body, $mode=0, $cc=NULL, $bcc=NULL, $attachment=NULL, $replyto=NULL, $replytoname=NULL ) {
global $mosConfig_debug;
$mail = mosCreateMail( $from, $fromname, $subject, $body );

// activate HTML formatted emails
if ( $mode ) {
$mail->IsHTML(true);
}

if( is_array($recipient) ) {
foreach ($recipient as $to) {
$mail->AddAddress($to);
}
} else {
$mail->AddAddress($recipient);
}
if (isset($cc)) {
if( is_array($cc) )
foreach ($cc as $to) $mail->AddCC($to);
else
$mail->AddCC($cc);
}
if (isset($bcc)) {
if( is_array($bcc) )
foreach ($bcc as $to) $mail->AddBCC($to);
else
$mail->AddBCC($bcc);
}
if ($attachment) {
if ( is_array($attachment) )
foreach ($attachment as $fname) $mail->AddAttachment($fname);
else
$mail->AddAttachment($attachment);
} // if
if ($replyto) { //BB: added this: important for being able to use mosMail without spoofing...
if ( is_array($replyto) ) {
reset($replytoname);
foreach ($replyto as $to) {
$toname = ((list($key, $value) = each($replytoname)) ? $value : "");
$mail->AddReplyTo($to, $toname);
}
} else
$mail->AddReplyTo($replyto, $replytoname);
}
$mailssend = $mail->Send();

if( $mosConfig_debug ) {
//$mosDebug->message( "Mails send: $mailssend");
}
if( $mail->error_count > 0 ) {
//$mosDebug->message( "The mail message $fromname <$from> about $subject to $recipient <b>failed</b><br /><pre>$body</pre>", false );
//$mosDebug->message( "Mailer Error: " . $mail->ErrorInfo . "" );
}
return $mailssend;
} // mosMail

Rybik
22-06-2006, 20:48
a mozesz opisac ideologicznie o co chodzi ? tak z mojej Rybikowej ciekawosci... tzn dlaczego ten kod lepszy i na czym to zabezpieczenie polega. Albo jakiegos linka (dzis ja niedobry i nie chce mi sie samemu szukac :D )