Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- 1. Make sure PEAR Mail and PEAR Net_SMTP are installed.
- 2. Add this php script somewhere on your server. (Edit the appropriate lines.)
- 3. The script assumes a Gmail email and emailing a Verizon VText email address to send via text message.
- 4. Then add a crontab line like this somewhere send you a message every 2 hours.
- 55 */2 * * * php /var/scriptfolder/stillfat.php > /dev/null 2>&1
- */
- require_once('Mail.php');
- date_default_timezone_set('America/New_York');
- echo "\n";
- $hour = date('H');
- if($hour > 8 && $hour < 20) {
- $from = '@gmail.com';
- $to = '###@vtext.com';
- $subject = '';
- $message = "You're still fat. Eat well. Move your body.";
- $message .= ' - ' . date('m/j/Y hA');
- $host = 'smtp.gmail.com';
- $username = '@gmail';
- $password = 'Password';
- $headers = array('From'=>$from, 'To'=>$to, 'Subject'=>$subject);
- $smtp = Mail::Factory(
- 'smtp',
- array(
- 'host'=>$host,
- 'auth'=>true,
- 'username'=>$username,
- 'password'=>$password
- )
- );
- $mail = $smtp->send($to, $headers, $message);
- if(PEAR::isError($mail))
- echo $mail->getMessage();
- else
- echo "Message sent.";
- }
- echo "\n\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement