Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Gabo's avatar
Level 10

Use php function mail() on Forge Site

Hi, i created a Forge site with a simple html page that have a contact form who call a PHP what use the mail() function to send the contact information. I used to have that page on a normal webserver , but now in Forge the contact form don't work. Can some one help me?

Thank you very much.

0 likes
2 replies
richard@gorbutt.com's avatar

Can't recall off-hand if the Forge builds had sendmail/postfix or whatever setup as standard. I think I fought that last year. Although I cracked it, any mail that came was flagged as spam so I just used mailgun as an SMTP gateway and let my apps connect to that!

Cronix's avatar

You will run into nothing but problems, from now until forever, if you send it from your host. There are many, many things you have to do and continue to fight to be able to get your email actually delivered and go to the inbox. You'll get cryptic messages from recipient email servers that your email has been blocked and flagged as spam, and go read this 10 page document on how to get it to work. Believe me, you will spend untold hours trying to get it to work for all ISPs, and you never will get it to work in all ISPs. You might get it fixed for one while it breaks others.

As suggested, use a service that maintains all of that for you and has reputable email servers, unless you are an expert in email systems, domain reputation, domain warming strategies, ip reputation, PTR, SPF, DKIM, DMARC and some other things I can't think of off the top of my head. Email is one of the most complex things on the internet that there is. Seems simple, but it's really not. It used to be...but...spam. Now there are all sorts of hoops to jump through, and each of the tens of thousands of ISPs that you will be sending email to will have their own rules you have to follow.

Huge companies have their own people dedicated to just maintaining their email servers because it takes expert knowledge, which costs a lot.

Even using gmail for sending outgoing email works fairly painlessly.

1 like

Please or to participate in this conversation.