Page 1 of 1
Automated Email Response
Posted: Wed Apr 21, 2004 10:12 pm
by Chris Corbyn
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
Posted: Wed Apr 21, 2004 10:34 pm
by tim
non-PHP related, but - there are autoresponders most web hosting companies offer. Perhaps u should check with them before u dip your toes in code?
Posted: Wed Apr 21, 2004 11:00 pm
by Chris Corbyn
hmmm, never realised that. Always got the impression people set these up by writing code.
I'll check with my email provider(s) if any of them offer this kind of service.
(The random string/ hyperlink would need to be code based of course so I'd still need to tackle that one.)
Thanks
Posted: Wed Apr 21, 2004 11:06 pm
by d3ad1ysp0rk
- 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

Posted: Wed Apr 21, 2004 11:19 pm
by Chris Corbyn
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
Posted: Wed Apr 21, 2004 11:21 pm
by feyd
Mail server is not built into IIS... at least last I used it..
Posted: Wed Apr 21, 2004 11:35 pm
by Chris Corbyn
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.
Posted: Wed Apr 21, 2004 11:41 pm
by Chris Corbyn
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.....
Posted: Wed Apr 21, 2004 11:54 pm
by Chris Corbyn
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?)
Posted: Thu Apr 22, 2004 12:05 am
by Chris Corbyn
Looking in phpinfo for the server my site is hosted on:
In PHP Core.....
sendmail_from: no value
sendmail_path: /not/allowed
SMTP: localhost
smtp_port: 25
Does this mean I can't send mail???
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
Posted: Thu Apr 22, 2004 12:13 am
by feyd
for security reasons all 'round I'd bet.
Posted: Thu Apr 22, 2004 12:19 am
by Chris Corbyn
Yeah no doubt. I'm a bit confused though because chmod is in that list of disabled functions but I use it all the time.
Looks like I'll be sending emails manually in batches once a day. (

)
Posted: Thu Apr 22, 2004 6:34 am
by magicrobotmonkey
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
Posted: Thu Apr 22, 2004 6:53 am
by redmonkey
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.