Automated Email Response
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Automated Email Response
Hi,
People are gonna laugh when they read this cos loads of people use them but I haven't got the foggiest how they work. I wish to be able to set up an automated email response for people wanting to sign up for my website.
People are gonna have to begin at very basics here, like... do you have to run the email server or can you do it for any email address you have etc? All I want is some sort of way of determining when an email arrives with a specific header (relating to payment for an item via PayPal) and a random string is sent (activation code) in reply along with a welcome message. The same random string added to my Database so that it can be checked against the user's input when they eventually get around to activating the account (or an activation hyperlink or whatever).
But first things first, where do I start right from scratch if I want to set this system up?
Thanks
People are gonna laugh when they read this cos loads of people use them but I haven't got the foggiest how they work. I wish to be able to set up an automated email response for people wanting to sign up for my website.
People are gonna have to begin at very basics here, like... do you have to run the email server or can you do it for any email address you have etc? All I want is some sort of way of determining when an email arrives with a specific header (relating to payment for an item via PayPal) and a random string is sent (activation code) in reply along with a welcome message. The same random string added to my Database so that it can be checked against the user's input when they eventually get around to activating the account (or an activation hyperlink or whatever).
But first things first, where do I start right from scratch if I want to set this system up?
Thanks
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
- Get an email server installed on your computer
- Include in the signup script, use of the mail() function
- In the body, send a random string that also is stored in the users row (in the database)
- The email contains the link to a page (verify.php?x=$randomstring&username=$username or whatever) which then querys the database to check if they match, if they do, it changes "active" or whatever variable you want it to be called, to 1 (or yes, or true, or whatever).
- Then when they want to do things on a page, in your general checks (ie. checking if they're logged in, etc...), check if active is yes or no (or 1 or 2, etc). If it's no, tell them they need to check their email to be able to login/do stuff and give them the option of sending it again (they provide the email, you query the database for a row with that email, then send the mail with the info again).
etc
- Include in the signup script, use of the mail() function
- In the body, send a random string that also is stored in the users row (in the database)
- The email contains the link to a page (verify.php?x=$randomstring&username=$username or whatever) which then querys the database to check if they match, if they do, it changes "active" or whatever variable you want it to be called, to 1 (or yes, or true, or whatever).
- Then when they want to do things on a page, in your general checks (ie. checking if they're logged in, etc...), check if active is yes or no (or 1 or 2, etc). If it's no, tell them they need to check their email to be able to login/do stuff and give them the option of sending it again (they provide the email, you query the database for a row with that email, then send the mail with the info again).
etc
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Sounds cool, and fairly simple but do I have to be running the entire site from my pc or just the email stuff? I can set a pop mail server up fairly easily with Windows XP Professional (I think it's built into IIS but I don't like running IIS as it's a big security risk cos of Microsoft's poor developing).
Maybe if I'm only running the mail server aspect and not the http: or ftp: stuff it should be ok. And norton firewall/virus protect should help. But the only problem is that my pc would need to be running 24/7 (Iguess it virtually does anyway lol
).
It'd be better if I was able to use an externally web based email server that runs 24/7 to deal with it. I'll get IIS running and have a play until I find an alternative.
Thanks
Maybe if I'm only running the mail server aspect and not the http: or ftp: stuff it should be ok. And norton firewall/virus protect should help. But the only problem is that my pc would need to be running 24/7 (Iguess it virtually does anyway lol
It'd be better if I was able to use an externally web based email server that runs 24/7 to deal with it. I'll get IIS running and have a play until I find an alternative.
Thanks
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Damn. Hmm. I wonder how all the mail() functions work in PHP. I assume the expect the mail service to be running on the same server as the PHP is running on. I'm workin on T35.com and they don't provide email services. I don't really wanna move though cos it's free and you get unlimited server space and bandwidth.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Yeah just looking at IIS now. There is an smtp service bu this will be no use since it's just for sending mail. The PHP would next to check a remote mailbox and then send from a different smtp server. Just been think about and due to mail relaying denial it may not be possible to get my PHP to send mail from another SMTP server, and I haven't got one with T35. I might be on a loser here.....
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Who knows anything about this mail() function then?
I've tried using it before by just copying and pasting the example for mail in the manual.
All I did was changed the "to:" and "from:" bits to email addresses that I owned but I never received my message
Does this mean that t35.com don't support mail sending features or is it purely php based? (I mean, does php require third party software to do it?)
I've tried using it before by just copying and pasting the example for mail in the manual.
All I did was changed the "to:" and "from:" bits to email addresses that I owned but I never received my message
Does this mean that t35.com don't support mail sending features or is it purely php based? (I mean, does php require third party software to do it?)
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Looking in phpinfo for the server my site is hosted on:
In PHP Core.....
I was a bit horrfied to find all these disabled functions too! there's some useful ones like exec and passthru that have been blocked. Might move server after all if I need to.
Cheers
Blocked functions (on a side note...)
In PHP Core.....
Does this mean I can't send mail???sendmail_from: no value
sendmail_path: /not/allowed
SMTP: localhost
smtp_port: 25
I was a bit horrfied to find all these disabled functions too! there's some useful ones like exec and passthru that have been blocked. Might move server after all if I need to.
Cheers
Blocked functions (on a side note...)
system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,
proc_open,shell_exec,chmod,chown,chroot,chgrp,fsockopen,
ftp_connect,ftp_ssl_connect,pfsockopen,socket_connect,
socket_create,socket_listen,socket_bind,socket_accept,socket_create_listen,socket_send,
socket_write,socket_read,symlink,mail,rename,copy
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA
C'mon now don't give up that easy!
First, look up phpMailer. Its a great little guy that you can use to send mime email like mad and you just put in the address of your smpt server.
Second, hotmail, i know, lets you use outlook express to use your hotmail account. When you set this up you can see the address there. Although its HTML based email not pop, you may be able to hunt around on their site and find more info. cURL may be of use here.
Third, I'm not sure php is going to do all this for you. Yes, you can send your email with the confirmation number easily enough, but I'm not sure if you will want to recieve the emails using php. Becuase something has to trigger it to go out and check the mail. You may be able to use like VB or something to write a script which grabs the title from an incoming address (into outlook or something) and checks it against the DB (probably use access to set up a linked DB to you mySQL db(or whatever db...)).
Sounds like fun! now get to work and lets see how it goes
First, look up phpMailer. Its a great little guy that you can use to send mime email like mad and you just put in the address of your smpt server.
Second, hotmail, i know, lets you use outlook express to use your hotmail account. When you set this up you can see the address there. Although its HTML based email not pop, you may be able to hunt around on their site and find more info. cURL may be of use here.
Third, I'm not sure php is going to do all this for you. Yes, you can send your email with the confirmation number easily enough, but I'm not sure if you will want to recieve the emails using php. Becuase something has to trigger it to go out and check the mail. You may be able to use like VB or something to write a script which grabs the title from an incoming address (into outlook or something) and checks it against the DB (probably use access to set up a linked DB to you mySQL db(or whatever db...)).
Sounds like fun! now get to work and lets see how it goes
For interacting with Paypal, you can setup IPN which will interact with a designated php script (you can use this to confirm a paypal payment then send a mail, add info to database etc..)
As for sending email, I'm not quite sure if this phpinfo is from your webserver provider or your local box? If it's from you webserver provider then the chances are you can just use the mail function without any problems (why not just try it). If this is your local box, then in many cases you can change the value of SMTP to that of your outgoing mail server provided by your ISP.
Again, if it is your local box, you can setup a SMTP server relatively easy, there are plenty of them out there some are free and others carry a nominal fee.
As for sending email, I'm not quite sure if this phpinfo is from your webserver provider or your local box? If it's from you webserver provider then the chances are you can just use the mail function without any problems (why not just try it). If this is your local box, then in many cases you can change the value of SMTP to that of your outgoing mail server provided by your ISP.
Again, if it is your local box, you can setup a SMTP server relatively easy, there are plenty of them out there some are free and others carry a nominal fee.