473,791 Members | 3,277 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

mail() error handling


I use mail() for a musician's mailing list script that suddenly started
having problems after many months of working flawlessly. The code fragment
is:

if (mail($To,$Subj ect,$Body,$Head ers,$Param))
{
print("The message was sent to:<p>$HTML_BCC <br><hr><h3>Com pleted
OK</h3><p>\n");
}
else
{
print("<font color=\"#ccff66 \">There was a problem and the
message was probably not sent.</font><br>\n");
}
How can I find out what is causing the error? I thought there were
built-in error number and error description messages, but a search of the
manual at php.net does not come up with anything.

Pierre
--
Pierre Jelenc | H o m e O f f i c e R e c o r d s
| * Ethan Lipton * Marwood * The Cucumbers *
T h e G i g o m e t e r | * Switchblade Kittens * Pawnshop *
www.thegigometer.com | www.homeofficerecords.com
Jul 17 '05 #1
8 52095
Hello,

On 12/02/2003 08:47 PM, Pierre Jelenc wrote:
I use mail() for a musician's mailing list script that suddenly started
having problems after many months of working flawlessly. The code fragment
is:

if (mail($To,$Subj ect,$Body,$Head ers,$Param))
{
print("The message was sent to:<p>$HTML_BCC <br><hr><h3>Com pleted
OK</h3><p>\n");
}
else
{
print("<font color=\"#ccff66 \">There was a problem and the
message was probably not sent.</font><br>\n");
}
How can I find out what is causing the error? I thought there were
built-in error number and error description messages, but a search of the
manual at php.net does not come up with anything.


The mail function will hardly give you any information. You would better
check the your mailer logs or send the messages directly to your
recipients SMTP server and see what it responds. In this case you may
want to try this class that comes with a subclass for interfacing with
the recipient SMTP server to perform direct deliveries.

http://www.phpclasses.org/mimemessage

You also need this:

http://www.phpclasses.org/smtpclass
--

Regards,
Manuel Lemos

Free ready to use OOP components written in PHP
http://www.phpclasses.org/

Jul 17 '05 #2
On 2003-12-02, Pierre Jelenc <rc**@panix.com > wrote:

I use mail() for a musician's mailing list script that suddenly started
having problems after many months of working flawlessly. The code fragment
is:
before the if put in this
echo "TO: $To SUBJECT: $Subject";

If it outputs "TO: SUBJECT: " then i think you're php version has
changed, and has register_global s=off now.
if (mail($To,$Subj ect,$Body,$Head ers,$Param))

--
verum ipsum factum
Jul 17 '05 #3
Tim Van Wassenhove <eu**@pi.be> writes:
On 2003-12-02, Pierre Jelenc <rc**@panix.com > wrote:

I use mail() for a musician's mailing list script that suddenly started
having problems after many months of working flawlessly. The code fragment
is:


before the if put in this
echo "TO: $To SUBJECT: $Subject";

If it outputs "TO: SUBJECT: " then i think you're php version has
changed, and has register_global s=off now.
if (mail($To,$Subj ect,$Body,$Head ers,$Param))


No, no problem there. In further tests we found that some of the mail does
go through sometimes, but in unpredictable manner. Unfortunately I don't
have access to the machine's configuration, it is a shared machine and to
reply to Manuel Lemos as well, we were told to use mail() and not attempt
to talk directly to sendmail (or I think qmail is what they use).

The mailing list is not terribly long, about 700 names that are all BCC'd,
and similar scripts on other hosts handle easily two thousand names.

Pierre
--
Pierre Jelenc | H o m e O f f i c e R e c o r d s
| * Ethan Lipton * Marwood * The Cucumbers *
T h e G i g o m e t e r | * Switchblade Kittens * Pawnshop *
www.thegigometer.com | www.homeofficerecords.com
Jul 17 '05 #4
On 2003-12-03, Pierre Jelenc <rc**@panix.com > wrote:
The mailing list is not terribly long, about 700 names that are all BCC'd,
and similar scripts on other hosts handle easily two thousand names.


Most ISPs don't accept mails with +500 bcc addresses.

Without access to /var/log/mail.(log|warn| error) it is hard to tell what
is going wrong.

--
verum ipsum factum
Jul 17 '05 #5
Tim Van Wassenhove <eu**@pi.be> writes:
On 2003-12-03, Pierre Jelenc <rc**@panix.com > wrote:
The mailing list is not terribly long, about 700 names that are all BCC'd,
and similar scripts on other hosts handle easily two thousand names.
Most ISPs don't accept mails with +500 bcc addresses.


This one does, it is actually a music-related company that offers cheap
web sites for poor musicians, and it does not put limits on the number of
addressees; each musician is known personally by the owners.
Without access to /var/log/mail.(log|warn| error) it is hard to tell what
is going wrong.


OK, I'll try to have them look at it and tell me if they see something.

Thanks,

Pierre
--
Pierre Jelenc | H o m e O f f i c e R e c o r d s
| * Ethan Lipton * Marwood * The Cucumbers *
T h e G i g o m e t e r | * Switchblade Kittens * Pawnshop *
www.thegigometer.com | www.homeofficerecords.com
Jul 17 '05 #6
Hello,

On 12/03/2003 09:06 PM, Pierre Jelenc wrote:
I use mail() for a musician's mailing list script that suddenly started
having problems after many months of working flawlessly. The code fragment
is:


before the if put in this
echo "TO: $To SUBJECT: $Subject";

If it outputs "TO: SUBJECT: " then i think you're php version has
changed, and has register_global s=off now.

if (mail($To,$Subj ect,$Body,$Head ers,$Param))

No, no problem there. In further tests we found that some of the mail does
go through sometimes, but in unpredictable manner. Unfortunately I don't
have access to the machine's configuration, it is a shared machine and to
reply to Manuel Lemos as well, we were told to use mail() and not attempt
to talk directly to sendmail (or I think qmail is what they use).


I do not know why you were told to do that because internally that is
exactly what the mail() function implementation does, ie, either
communicate directlty to the sendmail or qmail programs.

--

Regards,
Manuel Lemos

Free ready to use OOP components written in PHP
http://www.phpclasses.org/

Jul 17 '05 #7
Manuel Lemos <ml****@acm.org > writes:

I do not know why you were told to do that because internally that is
exactly what the mail() function implementation does, ie, either
communicate directlty to the sendmail or qmail programs.


I know, but this is a situation with people doing favors for other people
on systems that are working OK but without full-time tech staff, and once
they have something working (Ah! So they thought....) they don't want
anyone going beyond the fence.

Inspection of the logs shows what happened: Apparently, while going
through its BCC list, qmail encountered a non-responsive server. Instead
of skipping the problematic address and dealing with the others, it kept
retrying, and timed out.

What I don't understand is why qmail did not return "success" to mail()
once it had received all the data, *then* tried to deliver the mail. I
assume it's something that can be configured somewhere, as well as the odd
behavior of not skipping an address that is giving trouble, but it's out
of my reach.

Pierre
--
Pierre Jelenc | H o m e O f f i c e R e c o r d s
| * Ethan Lipton * Marwood * The Cucumbers *
T h e G i g o m e t e r | * Switchblade Kittens * Pawnshop *
www.thegigometer.com | www.homeofficerecords.com
Jul 17 '05 #8
Hello,

On 12/06/2003 05:18 PM, Pierre Jelenc wrote:
I do not know why you were told to do that because internally that is
exactly what the mail() function implementation does, ie, either
communicate directlty to the sendmail or qmail programs.

I know, but this is a situation with people doing favors for other people
on systems that are working OK but without full-time tech staff, and once
they have something working (Ah! So they thought....) they don't want
anyone going beyond the fence.


I think you are not understanding what is communicating directly with
sendmail or qmail. You do not have to change anything in your server. It
is just executing those programs like the mail() function does. I think
you are just fearing the unknown.

Inspection of the logs shows what happened: Apparently, while going
through its BCC list, qmail encountered a non-responsive server. Instead
of skipping the problematic address and dealing with the others, it kept
retrying, and timed out.
qmail does not do that. I think you are confused. Once you queue a
message with many Bcc: recipients, it will try to deliver the message to
many of them simultaneously upto to a limit of simultaneous deliveries.

All messages sent to addresses with delivery problems will make the
message stay in the queue for a while but that does not stop deliveries
of the same message or other message to other addresses.
What I don't understand is why qmail did not return "success" to mail()
once it had received all the data, *then* tried to deliver the mail. I
assume it's something that can be configured somewhere, as well as the odd
behavior of not skipping an address that is giving trouble, but it's out
of my reach.


qmail does not try to deliver messages immediately. You just queue the
message and it will try to delivery whenever it is possible. So, it
should always return success unless you have formatting problems that
make the qmail program fail and not queue any message at all.

--

Regards,
Manuel Lemos

Free ready to use OOP components written in PHP
http://www.phpclasses.org/

Jul 17 '05 #9

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

Similar topics

3
2375
by: Dave | last post by:
Hello all, I found Herb Sutter's article regarding error handling in the most recent CUJ to be very, very good. However, in trying to apply what I learned from the article, I am left with some questions. I have a function that takes a std::string (that represents a file name) as a parameter. This function reads in the contents of the file and returns a struct representing the file's content.
8
2260
by: Erencans | last post by:
Hi to all, I want to error handling in ASP. But i think that ASP is not enough for error handling. I have got two chance. 1. I can prapare an error page and control throught IIS. 2. I can use on error resume next. For 1. This is a general handling. I want to handle local error. Maybe i do special thing when error occured. For 2. I have to write alot of lines code. I have to control every line.
2
1775
by: Max | last post by:
Sometimes I get this error when testing web.mail: The server rejected one or more recipient addresses The server response was: 473 kjhg@Kjhg.com relaying prohibited. You should authenticate first This goes away when I simply put a try/catch around sending email, but I'm wondering if I can use this to my advantage -- come back to the user saying their email is invalid, try again? I'm asking if this is a good method, since I'm a little...
5
1527
by: Lau Lei Cheong | last post by:
Hello, I'm currently using Application_Error method in Global.asax.cs to handle errors. Recently, I heard about Page.ErrorPage and plan to use it for handling errors on certain pages. Are there any major difference in using these methods? My concern is mainly on the restrictions imposed on using these method.
10
2748
by: Justin Dutoit | last post by:
Hey. I'm still not experienced at error handling, and I need to know if Try.. Catch blocks are meant to be used to handle errors in your own app, ie bugs. Or, are they only for external things like db problems, file not found. Any websites or books on error handling, real-life examples, would be appreciated. Tks Justin Dutoit
4
1939
by: Al Williams | last post by:
Hi, I have error handling in place throughout my application. I also start the application wrapped in error handling code to catch any unexpected exceptions (i.e. exceptions that occur where I haven't placed error handling code). When I run my app from the IDE, the unhandled errors are caught by the error handling code in my Sub Main routine and the error details are logged to a text file and optionally e-mailed to me for follow-up.
3
372
by: dgiagio | last post by:
Hi, I'm creating a SMTP application and I would like to hear opinions about error handling. Currently there are two functions that communicate with the remote peer: ssize_t smtp_puts(smtp_stream_t *stream, const char *fmt, ...); ssize_t smtp_gets(smtp_stream_t *stream, char *buf, size_t len); Both of them return the number of written bytes to the stream, or -1 if
4
1583
by: Johnny Jörgensen | last post by:
Hi Does anyone know of a component that can facilitate error handling in a complex application. What I'm looking for is a component you can simply drop on your application form (or the like). If an exception occurs, it will generate a useful error message containing procedure, line number etc for the offensive code and either send it itself to a specified email address or give the user the option of reporting the error.
9
2560
by: arnuld | last post by:
Can anyone point me to some online/offline document on error handling in C ? I am doing some Socket Programming in C and feeling a lots of difficult in error handling :( Also some time ago some one told me that when I get an error then I can create a generic function which, when called within some function will print the name of that function automatically or something like that I forgot. It had lots of #define(s) . Can someone write...
0
9669
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9517
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
10428
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
10207
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...
1
7537
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5559
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4110
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
2
3718
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2916
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.