Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

PEAR mailing problem

 
   Database Help (Home) -> PHP RSS
Next:  Sending a GET request and getting the response us..  
Author Message
MJ

External


Since: Jan 30, 2007
Posts: 2



(Msg. 1) Posted: Tue Jan 30, 2007 4:31 am
Post subject: PEAR mailing problem
Archived from groups: comp>lang>php (more info?)

I use the following code to send mails using php usinf PEAR package.
When I run this code from command line using the command "php
automaticMail.php" the code works fine.
But when i run this script from browser it give the error :
Starting..... Error sending mail: (unable to connect to smtp server
10.110.8.212:25) End of Program

I am not figure out how this could happen ??? Sam code runs from
command line sending mails correctly but not through the apache
server.



<?php
require('Mail.php');
require_once 'PEAR.php';
echo "Starting.....";
$smtp_server="HOST";
$smtp_port="25";

$headers["From"] = "$from";
$headers["Reply-To"] = "$replyto";
$headers["To"] = $recipients;
$headers["Subject"] = "$sub";

$msg = "test";
$params["host"] = $smtp_server;
$params["port"] = $smtp_port;


if (PEAR::isError($mail_object = Mail::factory('SMTP', $params)))
{
echo "Failed to create PEAR::Mail object\n";
die();
}

if (PEAR::isError($send = $mail_object->send($recipients, $headers,
$msg)))
{
echo "Error sending mail: (". $send->getMessage() .")";
}
else
{
echo "Mail sent ". count($recipients) ." recipients.";
}

echo 'End of Program';
?>

 >> Stay informed about: PEAR mailing problem 
Back to top
Login to vote
MJ

External


Since: Jan 30, 2007
Posts: 2



(Msg. 2) Posted: Tue Jan 30, 2007 1:07 pm
Post subject: Re: PEAR mailing problem [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Kindly lemme know if any1 has any ideas on wht cud be wrong Sad

MJ


MJ wrote:
> I use the following code to send mails using php usinf PEAR package.
> When I run this code from command line using the command "php
> automaticMail.php" the code works fine.
> But when i run this script from browser it give the error :
> Starting..... Error sending mail: (unable to connect to smtp server
> 10.110.8.212:25) End of Program
>
> I am not figure out how this could happen ??? Sam code runs from
> command line sending mails correctly but not through the apache
> server.
>
>
>
> <?php
> require('Mail.php');
> require_once 'PEAR.php';
> echo "Starting.....";
> $smtp_server="HOST";
> $smtp_port="25";
>
> $headers["From"] = "$from";
> $headers["Reply-To"] = "$replyto";
> $headers["To"] = $recipients;
> $headers["Subject"] = "$sub";
>
> $msg = "test";
> $params["host"] = $smtp_server;
> $params["port"] = $smtp_port;
>
>
> if (PEAR::isError($mail_object = Mail::factory('SMTP', $params)))
> {
> echo "Failed to create PEAR::Mail object\n";
> die();
> }
>
> if (PEAR::isError($send = $mail_object->send($recipients, $headers,
> $msg)))
> {
> echo "Error sending mail: (". $send->getMessage() .")";
> }
> else
> {
> echo "Mail sent ". count($recipients) ." recipients.";
> }
>
> echo 'End of Program';
> ?>

 >> Stay informed about: PEAR mailing problem 
Back to top
Login to vote
Erwin Moller

External


Since: Sep 11, 2003
Posts: 337



(Msg. 3) Posted: Wed Jan 31, 2007 10:11 am
Post subject: Re: PEAR mailing problem [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

MJ wrote:

> Kindly lemme know if any1 has any ideas on wht cud be wrong Sad
>
> MJ

Hi,

We will.
This is a hell of an active usenetgroup.
I think nobody knows what is wrong.

I never use PEAR MAIL, but I would first try to send via php's own mail
function to see if you can send mail with that.

http://nl2.php.net/manual/en/function.mail.php

Regards,
Erwin Moller

>
>
> MJ wrote:
>> I use the following code to send mails using php usinf PEAR package.
>> When I run this code from command line using the command "php
>> automaticMail.php" the code works fine.
>> But when i run this script from browser it give the error :
>> Starting..... Error sending mail: (unable to connect to smtp server
>> 10.110.8.212:25) End of Program
>>
>> I am not figure out how this could happen ??? Sam code runs from
>> command line sending mails correctly but not through the apache
>> server.
>>
>>
>>
>> <?php
>> require('Mail.php');
>> require_once 'PEAR.php';
>> echo "Starting.....";
>> $smtp_server="HOST";
>> $smtp_port="25";
>>
>> $headers["From"] = "$from";
>> $headers["Reply-To"] = "$replyto";
>> $headers["To"] = $recipients;
>> $headers["Subject"] = "$sub";
>>
>> $msg = "test";
>> $params["host"] = $smtp_server;
>> $params["port"] = $smtp_port;
>>
>>
>> if (PEAR::isError($mail_object = Mail::factory('SMTP', $params)))
>> {
>> echo "Failed to create PEAR::Mail object\n";
>> die();
>> }
>>
>> if (PEAR::isError($send = $mail_object->send($recipients, $headers,
>> $msg)))
>> {
>> echo "Error sending mail: (". $send->getMessage() .")";
>> }
>> else
>> {
>> echo "Mail sent ". count($recipients) ." recipients.";
>> }
>>
>> echo 'End of Program';
>> ?>
 >> Stay informed about: PEAR mailing problem 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
PEAR newbie trying to user PEAR DB and falling at the firs.. - Hi, Ive just installed PEAR on my local machine and all is well, updated the include_path to point to my PEAR dir. So, when I just try to make a simple connection like so the script just seems to stop but no error messsages. I do get error messages..

Problem with PEAR + PHP5 + is_a function - FreeBSD 6.2 PHP 5.2.3 PEAR 1.6.1 Keep getting the below error: "Encountered error 2048 in /usr/local/share/pear/PEAR.php, line 281: is_a(): Deprecated. Please use the instanceof operator" I look through PEAR.php and it's full of is_a() funct...

php and pear - module API number matching problem - I've been trying to update php and have installed php 5.1.6 on slackware 11 and previously on 10.2 but when I run 'pear config-test' I keep on getting a message: PHP Warning: PHP Startup: Unable to load dynamic library '...mysql.so' - '...mysql.so':..

Pear: Mail_Queue problem, Cannot redeclare class mail_queu.. - Hi to all, I'm getting my hands into PEAR for a small newsletter-sending project. I need to boost the performance of the sending script and came accross this mail_queue class that should queue the emails. After sweating over the pear installation on..

Which mailing script do you recomend? - I'm looking for good, free mailing list manager script, which do you recomend?
   Database Help (Home) -> PHP All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can 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



[ Contact us | Terms of Service/Privacy Policy ]