Many websites rely on paid platforms like Mailchimp or SendGrid to handle contact form emails. But for a simple enquiry form, those services are not necessary. With an open-source PHP library and a free Google account, a website can send email directly through Google's mail servers at no ongoing cost.
Platforms like Mailchimp, SendGrid, and Postmark are excellent tools for sending newsletters or large volumes of transactional email. However, for a basic contact form that receives occasional enquiries, they introduce unnecessary complexity and monthly costs. Many of these platforms also have free tiers with strict limits, and they often require API key management, verified domains, and account setup that goes well beyond what a simple contact form actually needs.
The question is: can a website send email without any of that? The answer is yes, and it comes down to understanding how email delivery actually works.
When you send an email from Gmail or Outlook, your mail client connects to an SMTP server (Simple Mail Transfer Protocol) and hands off the message. That server then handles delivery to the recipient. This same mechanism is available to any application that can speak the SMTP protocol — including a PHP script running on a web server.
Google's mail infrastructure is available as an SMTP relay for any Gmail or Google Workspace account. This means a website can authenticate with Google's servers using a Google account and send email through them, piggybacking on the same reliable delivery infrastructure that powers Gmail.
PHPMailer is a free, open-source PHP library that handles the SMTP protocol so you do not have to write low-level connection code yourself. It is installed via Composer, the standard PHP package manager, and requires no subscription or account. The library has been maintained for over twenty years and is one of the most widely used PHP libraries in existence.
On the Google side, rather than using your main account password directly, Google allows you to generate an App Password — a separate credential scoped specifically to third-party applications. This is safer than sharing your main password, and it can be revoked at any time without affecting your Google account. The App Password is stored as an environment variable on the server, keeping it out of the codebase.
When a visitor fills in the contact form and clicks submit, the following happens:
There are three components in this setup: the PHP server, the PHP library, and Google's SMTP service. PHPMailer is open-source and free. Google's SMTP relay is available to any Gmail account at no charge, with a daily sending limit of 500 emails — more than enough for a contact form. The PHP server is whatever hosts the website, which is already a fixed cost.
There is no email platform account, no API key subscription, no transactional email pricing tier, and no vendor dependency. The only requirement is a Google account and a few environment variables set on the server.
This setup is well-suited for low-volume contact forms, enquiry pages, and notification emails where the volume is predictable and modest. It is not designed for sending newsletters to large lists or high-volume transactional email such as order confirmations at scale. For those use cases, a dedicated email delivery service is worth the cost.
But for a marketing or portfolio website where the goal is simply to receive enquiries without adding external dependencies, PHPMailer with Google SMTP is a clean, reliable, and cost-free solution that gives you full control over the delivery logic.