Advertisement
Guest User

Untitled

a guest
May 11th, 2017
562
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. <?php
  2. /*
  3. 1. Make sure PEAR Mail and PEAR Net_SMTP are installed.
  4. 2. Add this php script somewhere on your server. (Edit the appropriate lines.)
  5. 3. The script assumes a Gmail email and emailing a Verizon VText email address to send via text message.
  6. 4. Then add a crontab line like this somewhere send you a message every 2 hours.
  7.  
  8. 55 */2 * * * php /var/scriptfolder/stillfat.php > /dev/null 2>&1
  9. */
  10. require_once('Mail.php');
  11. date_default_timezone_set('America/New_York');
  12.  
  13. echo "\n";
  14.  
  15. $hour = date('H');
  16.  
  17. if($hour > 8 && $hour < 20) {
  18. $from = '@gmail.com';
  19. $to = '###@vtext.com';
  20. $subject = '';
  21. $message = "You're still fat. Eat well. Move your body.";
  22. $message .= ' - ' . date('m/j/Y hA');
  23.  
  24. $host = 'smtp.gmail.com';
  25. $username = '@gmail';
  26. $password = 'Password';
  27.  
  28. $headers = array('From'=>$from, 'To'=>$to, 'Subject'=>$subject);
  29. $smtp = Mail::Factory(
  30. 'smtp',
  31. array(
  32. 'host'=>$host,
  33. 'auth'=>true,
  34. 'username'=>$username,
  35. 'password'=>$password
  36. )
  37. );
  38.  
  39. $mail = $smtp->send($to, $headers, $message);
  40.  
  41. if(PEAR::isError($mail))
  42. echo $mail->getMessage();
  43. else
  44. echo "Message sent.";
  45. }
  46.  
  47. echo "\n\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement