473,698 Members | 2,409 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PEAR mailing problem

MJ
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.p hp" 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.p hp');
require_once 'PEAR.php';
echo "Starting....." ;
$smtp_server="H OST";
$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($recipien ts, $headers,
$msg)))
{
echo "Error sending mail: (". $send->getMessage() .")";
}
else
{
echo "Mail sent ". count($recipien ts) ." recipients.";
}

echo 'End of Program';
?>

Jan 30 '07 #1
2 2268
MJ
Kindly lemme know if any1 has any ideas on wht cud be wrong :(

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.p hp" 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.p hp');
require_once 'PEAR.php';
echo "Starting....." ;
$smtp_server="H OST";
$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($recipien ts, $headers,
$msg)))
{
echo "Error sending mail: (". $send->getMessage() .")";
}
else
{
echo "Mail sent ". count($recipien ts) ." recipients.";
}

echo 'End of Program';
?>
Jan 30 '07 #2
MJ wrote:
Kindly lemme know if any1 has any ideas on wht cud be wrong :(

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:2 5) 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($recipien ts, $headers,
$msg)))
{
echo "Error sending mail: (". $send->getMessage() .")";
}
else
{
echo "Mail sent ". count($recipien ts) ." recipients.";
}

echo 'End of Program';
?>
Jan 31 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
4405
by: Arne Kösling | last post by:
Hi ! I am new to Web Services. Therefore I ve set up a PHP Installation on Windows (PHP 4.3.2 and Apache 1.3.29). I have tested PHP alone and then installed PEAR. Now I am stuck there (Before that, I had many problems with the PHP-dlls) I've set up several SOAP Testscripts that I found on WebSites and in PHP-Books to get a PHP Client and a PHP Server communicate over Web Services (using PEAR::SOAP).
3
1553
by: hypodyne | last post by:
gday I am looking for a newsgroup Note I do not want a mailing list
0
1507
by: Analysis&Solutions | last post by:
Greetings: Crack open the beer, PEAR DB 1.6.0 is here! (Hey, I'm a bit giddy with excitement that my intense work during the past seven weeks has come to fruition.) For those unfamiliar with PEAR DB, it's a package of PHP classes that provide an object oriented API with common methods of accessing thirteen of PHP's database driver extensions: dBase, FrontBase, InterBase, Informix, mSQL, MS SQL Server,
3
7242
by: junkmail | last post by:
on a win 2k server apparantly it is saying i dont have it. or it cant find it. im using mySQL 4.1 php 4.3.x apache 3.0.53 im new to php and am doing some tutorials, but when i run the sripts it tells mea it can not run pear/soap, because it can not be found.the book im learning form does not tell me how to install or configure this extension. so now im looking for help.
1
3323
by: George | last post by:
I've got an interesting problem that I just have not been able to figure out. I'm trying to use Mail_Mime to send multi-part/mixed emails from a Linux server and I am having trouble getting everything to work together correctly. I recently migrated this client from one Linux server to another, and unfortunatley have no access to the old server to figure out what has changed or is different between the two. Needless to say, the email used...
2
5779
by: Alan Prescott | last post by:
I'm running SuSE Linux 9.3, fully up to date running # pear install db responds with ... downloading DB-1.7.6.tgz ... Starting to download DB-1.7.6.tgz (124,807 bytes) .............................done: 124,807 bytes requires package `PEAR' >= 1.0b1 DB: Dependencies failed Googling around this ng I found someone with a similar problem who solved it
0
2042
by: bwhitehd | last post by:
I'm having a problem installing php. The compile seems to go fine, but when it gets to the install step I get the following errors. Does anyone have an idea of what might be the problem? We build our applications under three different environments (Linux i686, Linux x86_64, Solaris 8 Sparc). This is the first of the three on a RHEL 3 system using the current stable versions of the GNU toolchain in a segregated environment. Basically...
1
13665
by: IchBin | last post by:
I remember having problems with pear when I first installed it but got it running some time ago. This is on a windoze XP SP OS. I did not think it was correct because it pointed to "C\php\pear\PEAR". I writing a pear front-end GUI and I want to have it installed correctly. It seemed to have some duplication of directories between the lower and upper cased pear dir names. Should there be a "php\pear\PEAR" subdirectory? I thought it should...
5
4517
by: Dan Fulbright | last post by:
I'm trying to install PHP 5.2.2 on Windows, but I keep getting errors when running go-pear.bat: mmap cache can't open phar://go-pear.phar/index.php mmap cache can't open phar://go-pear.phar/PEAR/Start/CLI.php mmap cache can't open phar://go-pear.phar/PEAR/Start.php There are 20 of these lines. After continuing through the script, it dies with this error:
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9166
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9030
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7737
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4371
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4621
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.