May 28, 201214 yr Strange request,but... My golf club has now moved to booking your tee time by email. I need my server (cpanel installed) to fire off an email from me to my golf club requesting a tee time at 7.30am every friday. If i don't get the mail in by 9.30, all the good tee times will be gone :-( I can do the cronjob bit, but surely there is a simple bit of php to send an email? or do i have to use sendmail or the like?? Regards Rich
May 29, 201214 yr Hi Rich! For sending emails using PHP, please check the following links: PHP Mail - W3schools PHP: mail - Manual - PHP Manual Regards, /Nanashi
May 29, 201214 yr Author Hi Nanashi, thanks for the reply, So i created a file called email.php and put the contents below in:- <?php $to = "me@myemail"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "me@myemail"; $headers = "From:" . $from; mail($to,$subject,$message,$headers); echo "Mail Sent."; ?> but when I ran the cron job i got the following error /home/***/public_html/cgi-bin/email.php: line 1: ?php: No such file or directory /home/***/public_html/cgi-bin/email.php: line 2: =: command not found /home/***/public_html/cgi-bin/email.php: line 3: =: command not found /home/***/public_html/cgi-bin/email.php: line 4: =: command not found /home/***/public_html/cgi-bin/email.php: line 5: =: command not found /home/***/public_html/cgi-bin/email.php: line 6: =: command not found /home/***/public_html/cgi-bin/email.php: line 7: syntax error near unexpected token `$to,$subject,$message,$headers' /home/***/public_html/cgi-bin/email.php: line 7: `mail($to,$subject,$message,$headers);' Can anyone shed some light on this for me, Am i missing a vital step here? really sorry for being such a noob. Regards Rich
Create an account or sign in to comment