Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Simple Cron email script

Featured Replies

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

  • 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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.