Solved

Where are sent email messages stored when sent using PHP's mail()?

Posted on 2007-03-28
4
224 Views
Last Modified: 2013-12-16
When I use the PHP mail() function to send mail, are the sent messages stored somewhere? How can I tell if the mails were really sent? For example, on my GoDaddy server I exceeded the daily limit of mails that can be sent and I only found out by accident.
Thanks
tr5
0
Comment
Question by:tr5
  • 3
4 Comments
 
LVL 29

Expert Comment

by:TeRReF
ID: 18806339
As far as I know the emails are not stored. If you put a valid email in the from header, you'll receive a failure notification when emails didn't reach their destination (you can also add a Bcc header to achieve the same without having to adjust uyour from header)
0
 
LVL 29

Expert Comment

by:TeRReF
ID: 18806347
Of course, mail() itself returns false if the sending fails..
0
 

Author Comment

by:tr5
ID: 18806363
Is there a way to configure PHP or sendmail or both to store the mails or a keep a record somehow?
What do you mean by "adding a BCC header"?
0
 
LVL 29

Accepted Solution

by:
TeRReF earned 500 total points
ID: 18806496
Well, using a Bcc header will send you an email as well which will have the same result as saving the send emails. To be notified of any failures, you will need the from/ reply-to header(s) to make sure that any failures are reported back to you.

You can send extra headers with the fourth parameter in mail(). So, something like this:

$headers = 'From: youremail@yourserver.com' . "\r\n" .
                    'Bcc: youremail@yourserver.com';

if (mail($email, $subject, $body, $headers) === false))
  die('Error while sending mail');
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now