Jump to content


Photo

automated emails


  • Please log in to reply
2 replies to this topic

#1 robcrozier

robcrozier
  • Members
  • PipPipPip
  • Advanced Member
  • 175 posts

Posted 01 October 2006 - 05:21 PM

hi everyone,

Here’s the problem im trying to solve.  I want to allow users to register their email addresses on a site in order to receive a monthly newsletter.  However to avoid spam I want to initially send an automated email to the address they registered with which will include a link which they can click on to verify that it was actually them.  When the link is clicked in the email I then want that persons email address to be stored in the database.

Can anyone give me a clue?

Cheers

#2 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 01 October 2006 - 05:31 PM

In the table containing the emails, have a field called is_activated with this type: ENUM('0','1')
and a field called activation code with something like this type: VARCHAR(50)

When they add their email and you add it to the database set is_activated to 0 and make a random activation code like
uniqid(md5($email.microtime());[code] Then send them a mail containg a link like this: http://example.com/activate.php?activation_code=**the activation code here**&email=**the email here**
on the activate page you should check if the email matches the activation code, and if it does, then set is_activated to 1.

When sending mails, only send it to email where is_activated is set to 1.[/code]


#3 robcrozier

robcrozier
  • Members
  • PipPipPip
  • Advanced Member
  • 175 posts

Posted 01 October 2006 - 05:38 PM

Thats spot on mate, exactly what i wanted.

Thanks a lot!!!
;D




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users