[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2007-03-28
4
Medium Priority
?
239 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 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses
Course of the Month20 days, 6 hours left to enroll

872 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