Title: wp-mail.php error?
Last modified: August 18, 2016

---

# wp-mail.php error?

 *  Resolved [nickyu](https://wordpress.org/support/users/nickyu/)
 * (@nickyu)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/wp-mailphp-error/)
 * Hey everyone!
 * I have a strange problem, (I am a newbie.. I guess everything is strange).
 * Anyways, when I run [http://www.mysite.com/wp-mail.php&#8230](http://www.mysite.com/wp-mail.php&#8230);
   I have no problems. Returns either I have posts or none.
 * BUT, when I run a cron job. I get this:
 * /home/nickandj/public_html/wp-mail.php: line 1: ?php: No such file or directory
 * /home/nickandj/public_html/wp-mail.php: line 2: syntax error near unexpected 
   token `dirname'`
 * /home/nickandj/public_html/wp-mail.php: line 2: 
    require(dirname(__FILE__) .‘/
   wp-config.php’);’
 * I am not sure if its something to do with the file or my server accessing it.
 * Has anyone else had this problem? or could someone point me in the right direction?
   I would rather have the server check for me, instead of having to run the script
   manually everytime.
 * Thanks for any help!
    Nick

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/wp-mailphp-error/#post-278507)
 * –
 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/wp-mailphp-error/#post-278508)
 * What the error is saying is that there is no `wp-mail.php` file in the root directory
   of your site. Is there one there? If you gave us the real URL to your site, it
   would help us to properly troubleshoot your problem.
 *  Thread Starter [nickyu](https://wordpress.org/support/users/nickyu/)
 * (@nickyu)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/wp-mailphp-error/#post-278512)
 * in my public html folder there is the file wp-mail.php
 * when I run [http://www.nickandjoanne.com/wp-mail.php](http://www.nickandjoanne.com/wp-mail.php)
   everything works great and posts emails (if they are there).
 * Otherwise when I run the Cron, it dosnt work, I get that error
 * Thanks for the quick response
 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/wp-mailphp-error/#post-278515)
 * Try this plugin: [http://www.skippy.net/blog/category/wordpress/plugins/wp-cron/](http://www.skippy.net/blog/category/wordpress/plugins/wp-cron/)
 *  Thread Starter [nickyu](https://wordpress.org/support/users/nickyu/)
 * (@nickyu)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/wp-mailphp-error/#post-278516)
 * I have that plug-in(as back-up), but I was hoping to get the Cron job working
   through the server. So that it is more reliable.
 * Apparently that plug isnt 100% from what I gather.
 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/wp-mailphp-error/#post-278518)
 * This may be helpful:
 * [http://codex.wordpress.org/Blog_by_Email#Cron_Job_Activation](http://codex.wordpress.org/Blog_by_Email#Cron_Job_Activation)
 *  Thread Starter [nickyu](https://wordpress.org/support/users/nickyu/)
 * (@nickyu)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/wp-mailphp-error/#post-278560)
 * I got it half working wth the Cron Job on the server, Thanks for the link, what
   I was forgetting was the ‘php’ in front of the command line.
 * Now it posts the tittle, but not the body of the text…any answers to this?
 *  Thread Starter [nickyu](https://wordpress.org/support/users/nickyu/)
 * (@nickyu)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/wp-mailphp-error/#post-278933)
 * Got it working for those reading this Thread….
 * ‘curl’ is the command line I had to use

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘wp-mail.php error?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 2 participants
 * Last reply from: [nickyu](https://wordpress.org/support/users/nickyu/)
 * Last activity: [20 years, 5 months ago](https://wordpress.org/support/topic/wp-mailphp-error/#post-278933)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
