2026年11月12日
2026年11月12日
Contact Form 7 Not Sending Email? Check From, Status, SMTP and SPF
This article is a localized edition of the Japanese original. Read the Japanese original
When email from Contact Form 7 (CF7) does not arrive, the message shown on the form tells you where to look.
- The form says "Thank you for your message. It has been sent." but nothing arrives → WordPress handed the email off. Check the From setting, spam filtering, and rejection on the receiving side.
- The form says "There was an error trying to send your message. Please try again later." → WordPress failed to send the email, or the submission was judged as spam. Tell the two apart with "2. Check the submission status" below.
Screen names were checked against the files of Contact Form 7 6.2 as distributed on WordPress.org, and its translations, as of November 2026.
1. Check the Mail tab settings
Open the form under "Contact → Contact Forms" in the admin and check the "Mail" tab.
| Field | What to check |
|---|---|
| To | Is it the address you want to receive at? The default is [_site_admin_email] (the Administration Email Address under "Settings → General") |
| From | Is it an address on the same domain as the site? The default looks like [_site_title] <wordpress@your-site-domain> (if the admin email address is on the site's domain, that address is used) |
| Subject | Is it empty? |
| Additional headers | Set the reply address here, for example Reply-To: [your-email] |
| Message body | Do the tag names (such as [your-name]) match the names in the form? |
The most common cause is putting the sender's address ([your-email]) in "From". For example, if the From address is a Gmail address but the email is sent from your site's server, the receiving side sees "a server other than Gmail claiming to be a Gmail address" and marks it as spam or rejects it. Use an address on your site's domain as From, and if you want to be able to reply to the sender, add Reply-To: in "Additional headers".
From: [_site_title] <wordpress@example.com>
Additional headers: Reply-To: [your-email]
If the From address is not on the site's domain, CF7 shows the warning "Sender email address does not belong to the site domain." on the form edit screen. Check whether this warning appears.
To send an automatic reply (a confirmation email to the sender), turn on "Use Mail (2)" and configure it. Use an address on your site's domain as From for Mail (2) as well.
2. Check the submission status
By default, CF7 shows the same "There was an error trying to send your message. Please try again later." both when sending fails and when it judges the submission as spam. You can tell which one it is with your browser's developer tools.
- Open the page with the form and open the "Network" tab of the developer tools
- Submit the form
- Look at the response of the request ending in
feedback(/wp-json/contact-form-7/v1/contact-forms/FORM_ID/feedback)
The status value in the JSON response tells you the result.
status |
Meaning | Where to look next |
|---|---|---|
mail_sent |
WordPress handed the email off | Sections 3 to 5 (From, spam filtering, SMTP, DNS) |
mail_failed |
WordPress's mail function (wp_mail()) failed |
Section 4 (logging the error) and section 5 (SMTP) |
spam |
Spam protection (reCAPTCHA, Akismet, the disallowed list and so on) judged it as spam, and no email was sent | Your spam protection settings |
validation_failed |
The input has errors | The form input and required fields |
3. Check for settings that skip sending
If either of the following is written in the form's "Additional Settings" tab, no email is sent, but the success message is still shown. Check that one was not left there after testing.
skip_mail: on
demo_mode: on
4. Log sending errors
If you get mail_failed, log the error with the wp_mail_failed hook, which WordPress runs when sending email fails. Add the code to your child theme's functions.php or to a plugin such as Code Snippets.
<?php
// When WordPress fails to send an email, write the reason to the PHP error log
add_action( 'wp_mail_failed', function ( WP_Error $error ) {
error_log( 'wp_mail failed: ' . $error->get_error_message() );
} );
// When a Contact Form 7 submission fails to send, log the form title and ID
add_action( 'wpcf7_mail_failed', function ( $contact_form ) {
error_log( sprintf( 'CF7 mail failed: "%s" (ID %d)', $contact_form->title(), $contact_form->id() ) );
} );
Where error_log() writes depends on the server's PHP settings. If you set WP_DEBUG and WP_DEBUG_LOG to true in wp-config.php, it is written to wp-content/debug.log. Set them back when you are done.
If the log shows something like Could not instantiate mail function., the mechanism PHP on your server uses to send mail (the mail() function or sendmail) is unavailable or restricted. In that case, switch to sending via SMTP as described in section 5.
You can also test WordPress's mail sending on its own, without going through the CF7 form (if WP-CLI is available). bool(true) means WordPress handed the email off.
wp eval 'var_dump( wp_mail( "you@example.com", "Test email", "This is a test email from WordPress." ) );'
5. Send via SMTP
If the status is mail_sent but nothing arrives, or mail_failed keeps happening, switch email sending to SMTP. By default WordPress sends mail with the server's PHP mail() function, which on some servers makes it more likely to be treated as spam. Sending through the SMTP server of your mail host or an email delivery service lets you combine it with authentication of the sending domain (SPF and DKIM), so mail is delivered more reliably.
There are two main ways to do this.
- Use an SMTP plugin: set the SMTP server details on a settings screen with WP Mail SMTP (
wp-mail-smtp), FluentSMTP (fluent-smtp) or similar. The differences are summarized in "Comparing WordPress SMTP plugins". - Configure it without a plugin: switch WordPress's mailer (PHPMailer) to SMTP with the
phpmailer_inithook.
<?php
// Define SMTP_HOST, SMTP_USER and SMTP_PASS in wp-config.php beforehand
add_action( 'phpmailer_init', function ( PHPMailer\PHPMailer\PHPMailer $phpmailer ) {
$phpmailer->isSMTP();
$phpmailer->Host = SMTP_HOST;
$phpmailer->Port = 587;
$phpmailer->SMTPAuth = true;
$phpmailer->SMTPSecure = 'tls'; // Use STARTTLS on port 587
$phpmailer->Username = SMTP_USER;
$phpmailer->Password = SMTP_PASS;
} );
Check the SMTP host name, port and authentication method in the documentation of your hosting company or email delivery service. To use Gmail's SMTP, turn on 2-Step Verification for your Google account, then create and use an app password. Setup steps and connection details for the main services are explained in "How to send WordPress email via SMTP".
6. Check SPF, DKIM and DMARC for the sending domain
Receiving mail servers look at the SPF, DKIM and DMARC records in the sending domain's DNS to decide whether the email came from a legitimate server. Gmail's sender guidelines require every sender to Gmail addresses to set up SPF or DKIM.
# SPF (the TXT record value starting with v=spf1)
dig +short TXT example.com
# DMARC
dig +short TXT _dmarc.example.com
If SPF does not include the server that actually sends the email (your web server or the email delivery service), the email is more likely to be treated as spam. What to add is described in your hosting company's or email delivery service's documentation.
You can also open a received email with "Show original" (in Gmail) and check that it shows spf=pass and dkim=pass.
7. Also save submissions on the site
To avoid losing inquiries even when email does not arrive, install the "Flamingo" plugin from the author of CF7. Submitted messages are then also saved in the admin, so nothing is lost while you investigate.
Notes
- When email does not arrive, first check the spam folder on the receiving side. With company email, messages may be quarantined on the receiving server, so ask the administrator.
- Do not write SMTP passwords or API keys directly in theme files; manage them as constants in
wp-config.phpor in the SMTP plugin's settings. - If you set the form's To field to an input value such as
[your-email], the form can be abused to send spam to third parties. Send to your own address, and send the automatic reply to the sender with Mail (2), keeping its content to a minimum. - To change the form messages (the success and failure texts), see "How to change Contact Form 7 error messages".
Questions about WordPress? The publisher of this site is based in Japan and replies in Japanese. Contact (Japanese)