Jump to content


This topic is now archived and is closed to further replies.


Emailing through PHP question

Recommended Posts

Hey all,

i'm designing an order system through php, the orders get emailed to my account and then the customers are taken to the payment system

however, if there is an error and the email doesn't get sent and the customer pays for it, i'll have no idea what they paid for

is there some form of code to make sure the email was sent successfully before continuing? and if the email fails, redirect the customer to another page?

cheers,  ;D

  - Joker

Share this post

Link to post
Share on other sites
You could use a try and catch block, catching exceptions an handling them effectively if you have php5 available. 

Otherwise, doing
mail() OR die()
would work too, but that would just notify the user that the mail wasn't sent. 

The normal way of handling this is to store the information in a database so even if the mail is not sent, it still exists in the database.  I'm not sure if this is feasible or not, but could be a good option.

Share this post

Link to post
Share on other sites
aye i recommended database storage as a priority, but this project has gone over schedule (by about 4 months, they only hired me 3 weeks ago) so a basic email record system will be used

database will definately be made for stage 2  ;D

thanks for the help

Share this post

Link to post
Share on other sites
it would take you 10 minutes to build a table within a database
it'll take you 5 minutes to program something to database, some form of identification for the orders, even if you just database there email address, and some other stuff.  What would take taht long.  10-20 minutes of extra work.THen you atleast have a list of emails of buyers, and you can match that against your emails to make sure your getting them all.  It would only take you 5 minutes
create 1 table called userinfo

1 field called
id - int(30) autoinc, prim
email - varchar - 200
that's it
then in the script
take the email address and insert it into the table
$insert = "INSERT INTO userinfo (email) VALUES ('$email');";
that's it in it's basic form you can build onto it from there, you can triplet he functionality in less that 30 minutes, that took 2 seconds.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.