wp_mail function not working properly??? (7 posts)

  1. FoodWriter
    Posted 6 years ago #

    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/.

    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.

    				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

    Reference another thread about same theme here: 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

  2. Shane G
    Posted 6 years ago #

  3. FoodWriter
    Posted 6 years ago #

    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.

  4. FoodWriter
    Posted 6 years ago #

    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.


  5. Per Søderlind
    Posted 6 years ago #

    @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)

  6. tetonshaggy
    Posted 6 years ago #

    Did you ever get this working? I am having the same issue?

  7. tetonshaggy
    Posted 6 years ago #

    Hostgator blocks port 465. They can fix it for you.

Topic Closed

This topic has been closed to new replies.

About this Topic