PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Some problems with Mail Implementation

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Mail
View previous topic :: View next topic  
Author Message
biz004



Joined: 12 Jan 2008
Posts: 1

PostPosted: Sat Jan 12, 2008 11:03 pm    Post subject: Some problems with Mail Implementation Reply with quote

Well, i'm using the Pear::Mail Class to implement into a SMF Forum[Simple machines Forum). But now, i only get problems with email sending.

This is my code.

function pear_mail($to_array, $subject, $message)
{
require_once "Mail.php";

global $modSettings, $webmaster_email, $txt, $context, $scripturl;

list (, $from_name) = mimespecialchars(addcslashes($from !== null ? $from : $context['forum_name'], '<>()\'\\"'), true, $line_break);
list (, $subject) = mimespecialchars($subject, true, $line_break);

if ($modSettings['mail_type'] == 3 && $modSettings['pearuser'] != '' && $modSettings['pearpass'] != '')
{
$pheaders = array ('From' => $from_name . '<' . (empty($modSettings['mail_from']) ? $webmaster_email : $modSettings['mail_from']) . '>' . $line_break,
'Reply-To' => '<' . $from . '>' . $line_break,
'Return-Path' => (empty($modSettings['mail_from']) ? $webmaster_email: $modSettings['mail_from']) . $line_break,
'Date' => gmdate('D, d M Y H:i:s') . ' -0000' . $line_break,
#{
# if ($message_id !== null && empty($modSettings['mail_no_message_id'])){
# 'Message-ID' => md5($scripturl . microtime()) . '-' . $message_id . strstr(empty($modSettings['mail_from']) ? webmaster_email : $modSettings['mail_from'], '@',
# }
#}
'X-Mailer' => 'SMF' . $line_break,
'Subject' => $subject);

$psmtp = Mail::factory('smtp',
array ('host' => $modSettings['pearhost'],
'port' => $modSettings['pearport'],
'auth' => true,
'username' => $modSettings['pearuser'],
'password' => base64_decode($modSettings['pearpass']),
'debug' => true));

$message = strtr($message, array("\r\n." => "\r\n.."));


$to_array = array_values($to_array);

foreach ($to_array as $i => $mail_to)
{
$pmail = $psmtp->send($mail_to, $pheaders, $message);
}
if (PEAR::isError($pmail)) {
echo("<p>" . $mail->getMessage() . "</p>");
log_error($txt['pearmail_error'] . ': ' . $errno . ' : ' . $errstr);
return false;
} else {
echo("<p>Mensaje Enviadou ^^!</p>");
echo $pmail;
echo '<br>';
echo $mail_to;
echo '<br>';
echo $pheaders;
echo '<br>';
echo $subject;
echo '<br>';
echo $message;
}
}
}

But, in this moment, there are some unresolved problems that i can't resolve:

1.- The Forum, each time that tries to send a Mail, shows
There was problems while trying to send mail. Error: 530 5.7.0 Must issue a STARTTLS command first 34sm6894079agc.24

- This is my debug of the Pear Actions

DEBUG: Recv: 220 mx.google.com ESMTP 20sm6928034agd.31 DEBUG: Send: EHLO localhost DEBUG: Recv: 250-mx.google.com at your service, [189.131.150.200] DEBUG: Recv: 250-SIZE 28311552 DEBUG: Recv: 250-8BITMIME DEBUG: Recv: 250-STARTTLS DEBUG: Recv: 250 ENHANCEDSTATUSCODES DEBUG: Send: STARTTLS DEBUG: Recv: 220 2.0.0 Ready to start TLS DEBUG: Send: EHLO localhost DEBUG: Recv: 250-mx.google.com at your service, [189.131.150.200] DEBUG: Recv: 250-SIZE 28311552 DEBUG: Recv: 250-8BITMIME DEBUG: Recv: 250-AUTH LOGIN PLAIN DEBUG: Recv: 250 ENHANCEDSTATUSCODES DEBUG: Send: AUTH LOGIN DEBUG: Recv: 334 XXXXXXXXX DEBUG: Send: XXXXXX DEBUG: Recv: 334 XXXXXXXXXXX DEBUG: Send: XXXXXXXXXXXXXXXXX DEBUG: Recv: 235 2.7.0 Accepted DEBUG: Send: MAIL FROM: DEBUG: Recv: 250 2.1.0 OK DEBUG: Send: RCPT TO: DEBUG: Recv: 250 2.1.5 OK DEBUG: Send: DATA DEBUG: Recv: 354 Go ahead DEBUG: Send: From: SMF Local Forum Reply-To: <> Return-Path: root@localhost Date: Sat, 12 Jan 2008 20:30:34 -0000 X-Mailer: SMF Subject: Hauu Hola biz, ^^ El siguiente es un correo Electrónico que te fue enviado por biz por medio de tu cuenta en SMF Local Forum. Si este mensaje es un Spam, contiene contenido abusivo u otros comentarios que puedas considerar ofensivos por favor contacta al Administrador del Foro en la siguiente direccion de Correo Electónico root@localhost El mensaje que te fue enviado es Ver 21
--SMF-b4d932867bfc3621f0f7fdcc9a94d3de Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 SG9sYSBCQmJ1cnUsIF5eDQoNCkVsIHNpZ3VpZW50ZSBlcyB1biBjb3JyZW8gRWxlY3Ryw7NuaWNv IHF1ZSB0ZSBmdWUgZW52aWFkbyBwb3IgQkJidXJ1IHBvciBtZWRpbyBkZSB0dSBjdWVudGEgZW4g RGlhcGVyIEZvcm8uIFNpIGVzdGUgbWVuc2FqZSBlcyB1biBTcGFtLCBjb250aWVuZSBjb250ZW5p ZG8gYWJ1c2l2byB1IG90cm9zIGNvbWVudGFyaW9zIHF1ZSBwdWVkYXMgY29uc2lkZXJhciBvZmVu c2l2b3MgcG9yIGZhdm9yIGNvbnRhY3RhIGFsIEFkbWluaXN0cmFkb3IgZGVsIEZvcm8gZW4gbGEg c2lndWllbnRlIGRpcmVjY2lvbiBkZSBDb3JyZW8gRWxlY3Qmb2FjdXRlO25pY28gcm9vdEBsb2Nh bGhvc3QNCg0KRWwgbWVuc2FqZSBxdWUgdGUgZnVlIGVudmlhZG8gZXMNClZlciAyMQ== --SMF-b4d932867bfc3621f0f7fdcc9a94d3de-- .
DEBUG: Recv: 250 2.0.0 OK 1200170012 20sm6928034agd.31 DEBUG: Send: QUIT DEBUG: Recv: 221 2.0.0 mx.google.com closing connection 20sm6928034agd.31

--------

Pear::Mail don't send anything, until the DEBUG shows clearly that the mail was sent correctly.

2.- I have another problem with this script, probed separately [outside of forum] but i don't know if is a problem of my Current Mail program or is a Error in the script, because i only receive the mails sent by pear on the WebMail, but don't in Thunderbird.

Well, Thanks for reading ^^

Biz004
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Mail All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement

'Actiemonitor' online projectmanagement software