zed420 Posted November 13, 2008 Share Posted November 13, 2008 Hi All Is there way that I can save my sent mail that I have sent via php? Thanks Zed Quote Link to comment https://forums.phpfreaks.com/topic/132605-how-to-save-sent-mail/ Share on other sites More sharing options...
webguy1620 Posted November 13, 2008 Share Posted November 13, 2008 Sure, why don't you just save it to a table or something of that nature? Quote Link to comment https://forums.phpfreaks.com/topic/132605-how-to-save-sent-mail/#findComment-689648 Share on other sites More sharing options...
DeanWhitehouse Posted November 13, 2008 Share Posted November 13, 2008 where the code sends the mail make it save the details to a database or flat file storage system. The database could be set up like: Database setup id INT 11 Primary Key auto_increment sender VARCHAR 20 recipient TEXT message TEXT time_sent TIMESTAMP CURRENT TIMESTAMP sender would not be needed if it is always sent by one person, and recipient can be changed to a number if you have a members table with unique id's. Quote Link to comment https://forums.phpfreaks.com/topic/132605-how-to-save-sent-mail/#findComment-689653 Share on other sites More sharing options...
iversonm Posted November 13, 2008 Share Posted November 13, 2008 ya so basically you have your title, body, and who you sent it to just insert it into a table if the sending is successful so something like this $mail=mail($recipient, $subject, $mail_body, $header); if($mail){//mail was sent correctly $q="INSERT INTO mail ...." etc i think you should know how to insert into a database if not tell me and ill actually type it out then query $q so ya you should know how to do that too }else{//mail was not sent so i would report this too so you can see when you dont have mail sent succressfully do something to report mail not setn } Quote Link to comment https://forums.phpfreaks.com/topic/132605-how-to-save-sent-mail/#findComment-689656 Share on other sites More sharing options...
DeanWhitehouse Posted November 13, 2008 Share Posted November 13, 2008 I would say it would be better to save it even if it was unsuccessful, this way you can find out what people have failed to send and if need be recover it. <?php $mail=mail($recipient, $subject, $mail_body, $header); if($mail) { $success = 1;//means successful } else { $success = 0;//means un-successful } mysql_query("INSET INTO table (row,success) VALUES ('value','$success')"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/132605-how-to-save-sent-mail/#findComment-689658 Share on other sites More sharing options...
zed420 Posted November 14, 2008 Author Share Posted November 14, 2008 My sincere thanks go to all of you who helped me on this . Specially Blade280891 , iversonm and webguy1620 you guys were brilliant. Thank you Zed Quote Link to comment https://forums.phpfreaks.com/topic/132605-how-to-save-sent-mail/#findComment-690241 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.