I'm trying to send e-mail using PEAR's Mail class--for testing purposes
actually, I've never had any problem with conventional mail(). This is
what my code looks like:
$mail_object=&Mail::factory('sendmail', $params);
if($mail_object->send($to, $headers, $body)){
header('Location: '.$url_ok);
}else{
header('Location: '.$url_ko);
}
This works (i.e., sends mail) but I know it isn't fine. My code never
shows any error, even after removing sendmail link... The send() method
returns "TRUE or a PEAR_Error object, if fails" and I just can't figure
out how to use that. PEAR online manual doesn't include an example of
error handling, at least in this chapter, and I'm rather new to object
oriented programming. I'd greatly appreciate a little example.
--
--
-- Álvaro G. Vicario - Burgos, Spain
-- 2 5813
Hello,
On 10/28/2003 01:37 PM, Alvaro G Vicario wrote: I'm trying to send e-mail using PEAR's Mail class--for testing purposes actually, I've never had any problem with conventional mail(). This is what my code looks like:
$mail_object=&Mail::factory('sendmail', $params); if($mail_object->send($to, $headers, $body)){ header('Location: '.$url_ok); }else{ header('Location: '.$url_ko); }
This works (i.e., sends mail) but I know it isn't fine. My code never shows any error, even after removing sendmail link... The send() method returns "TRUE or a PEAR_Error object, if fails" and I just can't figure out how to use that. PEAR online manual doesn't include an example of error handling, at least in this chapter, and I'm rather new to object oriented programming. I'd greatly appreciate a little example.
I don't use PEAR so I can't tell you what is wrong. However, I can
recommend this other class for composing and sending messages that also
has a sub-class specialized in deliverying messages directly with the
sendmail program. I can assure you that when the sendmail program is
missing, it will fail returning false and you can check the error class
variable to know more about the failure. http://www.phpclasses.org/mimemessage
--
Regards,
Manuel Lemos
Free ready to use OOP components written in PHP http://www.phpclasses.org/
*** Manuel Lemos escribió/wrote (6:16:34 29/10/2003): I can assure you that when the sendmail program is missing, it will fail returning false and you can check the error class variable to know more about the failure.
http://www.phpclasses.org/mimemessage
Thank you for your remark, I didn't know about this class repository.
About PEAR, I finally got some inspiration. I guess you just have to
test returned value against true using the "===" operator and, if you
need further info in case or error, you can save that value into a
variable and just access its methods.
--
--
-- Álvaro G. Vicario - Burgos, Spain
-- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Corey |
last post by:
I'm running Windows/Outlook XP with mail routed through POP3/SMTP university servers. Abruptly, I am no longer able to send mail, though receiving works fine. I get an error message saying that...
|
by: eric |
last post by:
Hello, I write a simple code to send email via my webpage.
But there is no errors in the program when I trace it, and NO EMAIL get received in my hotmail box. Any idea? Seems all emails not been...
|
by: Jim Mitchell |
last post by:
I like to display my web site in a window so that users can use the "Send
Page" function in IE to mail their output using their client side Outlook
program.
The problem is that I always get an...
|
by: marsandys |
last post by:
Hello, I have this code below, which I am trying to have it send HTML
formatted mail with embedded images. I can get this to send the mail,
but it spits out a bunch of junk . I know
this should...
|
by: mayanksrmcem |
last post by:
I need ur help.
I want to send emails through php code.
but there are some problems n i'm not able to understand the actual problems.
the code , i've used is as followes----
<?php
if...
| |
by: Amit Singla |
last post by:
Hi
plz tell me How mail send through cdosys.dll
Thanks & Regards
Amit Singla
|
by: Kevien Lee |
last post by:
Hi,
When use the SmtpClient class,it is easy to send an e-mail,but how to
konw that if the mail send successful,such as timeout and so on?
can anyone advice me?
Thanks
|
by: redblue |
last post by:
Hi all, i am new in php, I looked lots of example from Forum and tried online server but its nt work at all, i know i may be doing great mistake to sending HTML mail. last time i tried this code...
|
by: jayanthnadig |
last post by:
Hi All,
in our .Net(C#) windows application a modaless window will open with a textbox in focus. we have to enter the value in textbox programatically and close that window. is that possible using...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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,...
| |
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
|
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,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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...
| |