Prevent Email Warning from Gmail

Preventing email warnings from Gmail about suspicious messages from your site.

By Bob Ray  |  April 8, 2025  |  3 min read
Prevent Email Warning from Gmail

If you use SPForm or another email add-on for a contact form and have been getting warnings from Gmail suggesting that the user who emailed you might not be who they claim to be, this article will explain why that happens and how to prevent it.

The Problem

The error usually occurs when you use Gmail and so does the user filling out the contact form. By default, SPForm uses the email address entered by the user for both the "from" and the "Reply-to" fields. The message sent from the contact form is sent to the site admin (or whoever) using your server or a server you designate. If that "from" address (entered by the user) is a gmail.com address, Gmail knows it really didn't come from Gmail and warns you that the user might be trying to mislead you.

The Solution

The trick for solving this is to tell the email extra to use the emailsender System Setting for the "from" address. For SPForm, setting the &useemailsender property to 1 in the SPForm tag will tell SPForm to use the System Setting rather than the email entered in the form.

Now, SPForm will use the emailsender System Setting for the "from" address. The email entered by the user will still go in the "reply-to" header so you'll still be able to reply to the user's email in the normal way. Because the "from" address is your address, not the user's, Gmail won't complain about any possible chicanery.

To make this work, be sure that the emailsender System Setting is an address at the domain of your site, or that it matches the server that's going to be sending the email. Also, make sure that the emailsender address matches an email account at the server that has permission to send emails.

For other contact form systems, you can explicitly set the "from" address (and sometimes the "sender" address) to an email address at your server and set "reply-to" to the address the user entered.

Something Else to Think About

If you've been sending other message to your users (e.g., registration messages), and your "from" address is at Gmail, Gmail users may be getting the same warning messages described above. That could definitely affect the number of users who follow through on the registration process.

Coming Up

In my next article, we'll see how to create a widget to toggle a Yes/No System Setting.


Bob Ray is the author of the MODX: The Official Guide and dozens of MODX Extras including QuickEmail, NewsPublisher, SiteCheck, GoRevo, Personalize, EZfaq, MyComponent and many more. His website is Bob’s Guides. It not only includes a plethora of MODX tutorials but there are some really great bread recipes there, as well.