Jump to content


Photo

Emailing through PHP question


  • Please log in to reply
3 replies to this topic

#1 irrelevantjoker

irrelevantjoker
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 03 October 2006 - 06:00 AM

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

#2 Hi I Am Timbo

Hi I Am Timbo
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts

Posted 03 October 2006 - 07:05 AM

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.

#3 irrelevantjoker

irrelevantjoker
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 03 October 2006 - 10:08 PM

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

#4 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 03 October 2006 - 10:26 PM

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');";
mysql_query($insert);
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.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users