0

My contact form in wordpress is not working. When the contact form is submitting, I get the following message

Message sending failed " ... the SMTP setting is not configured..

How can I make the Mail to send. I'm using the plugin Contact Form7. How can I set up the email so that it will send to the user...

1 Answer 1

0

Wordpress uses PHPMailer class and has an action hook that you can use to configure it. For example:

add_action( 'phpmailer_init', 'cyb_smtp_config' );
function cyb_smtp_config( $phpmailer ) {
    $phpmailer->IsSMTP();     
    $phpmailer->Host = 'smtp.mailer.com';
    $phpmailer->Port = 25;
    $phpmailer->Username = 'username';
    $phpmailer->Password = 'password';
}

Be sure that you need a custom SMTP connection instead of configuring the SMTP service in your hosting. If you are not sure, contact with your hosting provider.

2
  • where i have to put this function .... ?? i have to write it in the function.php ??? or any where else ... Commented Jul 24, 2014 at 9:11
  • In functions.php or in a plugin file
    – cybmeta
    Commented Jul 24, 2014 at 9:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.