Working Contact Page

Ubuntu Server 22.04 LTS
Virtualmin version 7.3.1

Please advise on how to get a contact page up and running. I created a contact html page and a mail.php page along with a little css. What am I missing?

We can’t possibly guess what you’re missing, you haven’t told us anything useful.

What errors do you get (in the error log for the domain in question, the client doesn’t generally have any useful information) when you visit your mail form and submit it in a browser?

That sounds like you are asking someone to design a website for you?
If so, not appropriate here

The server application (backend) to process the request to your site from the “contact page”

Thanks for responding.
This question is related to a question I asked a few weeks ago about getting my email working. I was advised that I needed to ask my ISP to open port 25 or configure a relay.

I don’t need anyone to “design” a website for me. I have 17. I just need help on a working contact page. My guess is that I need to have my ISP open port 25 or use a relay for the contact page. I just wasn’t sure.

We’re happy to help, but we need good questions with enough information for us to be able to diagnose a problem.

Usually, that means we need relevant log entries. In this case, the error log from the web server and the maillog/mail.log (or the journal entries if Postfix is logging to the journal instead of a text log).

And, yes, you continue to need port 25 to be open for you to be able to send mail to the rest of the internet, or you need to relay through some other server/service that does have port 25.

Is the server able to send mail in the ordinary way? If so, the error is most likely in your html or php.

Posting the code (redacting anything sensitive if necessary) would help, as well as the error logs Joe mentioned.

Otherwise, read this.


This mail.php works fine in my VM.
Preformatted text<?php
if(isset( $_POST[‘name’]))
$name = $_POST[‘name’];
if(isset( $_POST[‘email’]))
$email = $_POST[‘email’];

$content=“From: $name”;
$recipient = “”;
$mailheader = “From: $email \r\n”;
mail($recipient, $subject, $content, $mailheader) or die(“Error!”);
echo “Email sent!”;

Thanks for your help! I will keep testing.

Yes. My email worked right out of the box. I can send email internally, but not externally. I have to ask my ISP to open up port 25. I guess in order to get a working contact page I have to get my email working externally.

Thanks. I will keep working on it and let you know.