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


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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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