Re: Scheduled emails
- From: "J.O. Aho" <user@xxxxxxxxxxx>
- Date: Sat, 08 Nov 2008 11:48:00 +0100
©® wrote:
When I used to host with Godaddy, they had a feature whereby you could
type an email and send it at a specific date and time - great for me to
send birthday wishes to people so I don't forget!
Now I am with Bluehost and they use CPanel but I don't see any feature
like that.
Is this something that can be accomplished in PHP? I am *very* new to
PHP so am newer than a newbie so hope someone can help.
Thanks
You need the php script that sends the mail to be run once in a while, usually
done as a cron job, if you don't have that possibility, things will be
depending on outside actions. If you have a site with enough users, you could
build the whole mail sending to the web pages, so that when a user visits a
page, a check is made if it's time to send a mail or not, if time, then send
it, this will of course generate the risk of multiple mails sent to the same
person, as it could be possible that more than one person is accessing the
page, trigger the sending of the mail before the mail has been removed from
the cue or marked as sent.
Of course you can have one page that sends mail and that one is periodically
loaded from another computer which you have cron job access, but in that case,
you can have the whole php stuff on that machine instead of your web hotel.
If you have shell access, then you can write an infinitive loop with sleep,
that once ever X minute checks the mail cue, and sends the mail if it time,
this script can be run in screen or background, so that you can log off the
shell (otherwise you need to be connected all the time).
In the long run, a cron job is the easy way, but most web hotels won't give
you any such access, same with shell accounts.
The code of a mail sender that reads input from file/database is quite simple
and you get all the information you need by reading the php.net online manual,
start with mail(), this function may be disabled, then you need a third party
package that provides you with a simple SMTP features.
--
//Aho
.
- References:
- Scheduled emails
- From: ©®
- Scheduled emails
- Prev by Date: Scheduled emails
- Next by Date: Re: Howto determine from which file an image is being requested?
- Previous by thread: Scheduled emails
- Index(es):
Relevant Pages
|