Title: wp_mail function not working properly???
Last modified: August 19, 2016

---

# wp_mail function not working properly???

 *  [foodwriter](https://wordpress.org/support/users/foodwriter/)
 * (@foodwriter)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/wp_mail-function-not-working-properly/)
 * Hello everyone,
 * I’m using a theme that calls the mail() function to email it’s users after a 
   successful post. The installation is hosted at hostgator with limits the use 
   of mail() so I’m using this plugin for smtp [http://wordpress.org/extend/plugins/hgk-smtp/](http://wordpress.org/extend/plugins/hgk-smtp/).
 * Changed the mail() call to wp_mail() and it’s still not working. I’ve only been
   able to locate one instance of the call in the template files.
 *     ```
       <?php
   
       				if ( get_option('successmail') == "Enable" && get_option('publish') == "On" ) {
   
       				$subject = get_option('mailsubject');
   
       				$name = $_POST['address_name'];
       				$name = str_replace("+", " ", $name);
       				$websitename = get_bloginfo('name');
   
       				$message = get_option('mailcontent');
       				$message = str_replace("[buyer_name]", "$name", $message);
       				$message = str_replace("[website_name]", "$websitename", $message);
   
       				wp_mail($mail, $subject, $message); }
   
       				?>
       ```
   
 * The installation is here: [Template](http://hireseasonal.com/)
 * Reference another thread about same theme here: [http://wordpress.org/support/topic/206428](http://wordpress.org/support/topic/206428)
 * Where else would I need to change the mail() function? In any of the wordpress
   template files?
 * Thanks in advance

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

 *  [shane-g](https://wordpress.org/support/users/shane-g/)
 * (@shane-g)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/wp_mail-function-not-working-properly/#post-1247831)
 * Hi,
 * Have a check with these plugins:
 * [http://wordpress.org/extend/plugins/wp-email/](http://wordpress.org/extend/plugins/wp-email/)
   
   [http://wordpress.org/extend/plugins/wp-mail-smtp/](http://wordpress.org/extend/plugins/wp-mail-smtp/)
 * Thanks,
 * Shane G.
 *  Thread Starter [foodwriter](https://wordpress.org/support/users/foodwriter/)
 * (@foodwriter)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/wp_mail-function-not-working-properly/#post-1247850)
 * Thanks Shane.
 * Well, the plugins seem to work just the one I had already installed. At least,
   they do send the test message.
 * The problem is probably with the code/template itself.
 *  Thread Starter [foodwriter](https://wordpress.org/support/users/foodwriter/)
 * (@foodwriter)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/wp_mail-function-not-working-properly/#post-1247881)
 * The reference in the codex for wp_mail is:
 * `<?php wp_mail( $to, $subject, $message, $headers, $attachments ); ?>`
 * Looking at the code above, I don’t think it follows the first required parameter.
 * Hmmmmmm….????
 *  [Per Søderlind](https://wordpress.org/support/users/pers/)
 * (@pers)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/wp_mail-function-not-working-properly/#post-1248009)
 * [@foodwriter](https://wordpress.org/support/users/foodwriter/), the syntax is:
   `
   wp_mail( $to, $subject, $message, $headers = '', $attachments = array() )` so,
   the last two parameters are optional (if you don’t set them, $headers will be
   an empty string and $attachmens will be an empty array)
 *  [tetonshaggy](https://wordpress.org/support/users/tetonshaggy/)
 * (@tetonshaggy)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/wp_mail-function-not-working-properly/#post-1248037)
 * Did you ever get this working? I am having the same issue?
 *  [tetonshaggy](https://wordpress.org/support/users/tetonshaggy/)
 * (@tetonshaggy)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/wp_mail-function-not-working-properly/#post-1248038)
 * Hostgator blocks port 465. They can fix it for you.

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

The topic ‘wp_mail function not working properly???’ is closed to new replies.

## Tags

 * [jobpress](https://wordpress.org/support/topic-tag/jobpress/)
 * [mail function](https://wordpress.org/support/topic-tag/mail-function/)
 * [wp_mail](https://wordpress.org/support/topic-tag/wp_mail/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 4 participants
 * Last reply from: [tetonshaggy](https://wordpress.org/support/users/tetonshaggy/)
 * Last activity: [16 years, 4 months ago](https://wordpress.org/support/topic/wp_mail-function-not-working-properly/#post-1248038)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
