Recover PHP mail

teammatt3's picture

He has: 2,102 posts

Joined: Sep 2003

Is there a way to view/recover the emails you sent with mail()? Would they be in a server log somewhere?

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

Don't know if you can or not but a way around this in the future is to BCC: an e-mail address specifically set up for receiving them, which is how I do it. (ie. all sign up receipts and renewal receipts BCC a copy to me that I archive off.

-Greg

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

That's a good way of doing it Greg. PHP's mail() function just uses whatever smtp server is installed on the machine. That's usally sendmail isn't it? I'm 99% certain sent messages aren't saved unless you've specified it somehow, e.g. in the additional_parameters.

You might be able to find a way of saving sent messages, check you're using sendmail, then have a look at the documentation on: http://www.sendmail.org/ or--probably easier--just use Greg's method. Smiling

a Padded Cell our articles site!

teammatt3's picture

He has: 2,102 posts

Joined: Sep 2003

Definitely going to use Greg's method from now on. The problem is, I wasn't before and I found out that the emails weren't being sent for a few days. I need to figure out which ones need to be re-sent. Looks kind of hopeless now. I'll have to check out the sendmail docs though. Oh boy Sticking out tongue

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

matt wrote: I need to figure out which ones need to be re-sent.

Ack, well often the only way we learn stuff is by making the odd mistake or two. Smiling

Good luck working out which ones need to be re-sent, and if you need a hand you know where we are!

a Padded Cell our articles site!

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

Re-mail everyone for the the past week, and explain to those who may be getting duplicates it was an issue with "Solar Flares".... LOL

-Greg

They have: 173 posts

Joined: Feb 2005

Don't all MTA have some form of a log?

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Triexa.com wrote: Don't all MTA have some form of a log?

Hmmm, you might be right, maybe I should have investigated this better. On our server there's a /var/log/maillog, depending on your settings there should be a log on your server too Matt. Nice one Triexa. Smiling

Greg K wrote: explain to those who may be getting duplicates it was an issue with "Solar Flares"

Wasn't that an excuse used by the BOFH? Laughing out loud

a Padded Cell our articles site!

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Sorry for double-posting...
Having said the above, looking into our /var/log/maillog (and the archived maillog.1 etc.) they're completely empty! It might just be our strange server setup though, Plesk stores things in funny places (Plesk sucks).

a Padded Cell our articles site!

teammatt3's picture

He has: 2,102 posts

Joined: Sep 2003

Oooo, I'll have to check that out (I don't have root access on this server so it might be a while) but I did a long listing on it, and it's 200 megs in size. This looks good Smiling

Thanks!!!

He has: 629 posts

Joined: May 2007

Dunno if you have come across Wufoo? They have some very nice forms, highly customizable, and free to bloggers and non-profits. You can host the form handling on their site, in which case every form sent is saved in an archive for later viewing; or they have copy-and-paste code for hosting on your own site.

They use the latest in anti-spam techniques as well. Worth checking out, IMHO.

Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.