# [SOLVED] Webpage Online Contact Form Problems (using Apache)

## rrrssssss

Hello Gentoo Forum,

I installed Apache2 on my personal home computer in order to host my own web page, (index.html) and this web page is located in the /var/www/localhost/htdocs folder so it can be accessed by anybody on the Internet.

I then put a online contact form in my web page for whoever would like to submit comments about my web site and I used a free web site called "response-o-matic.com" to make the form work using a PHP script hosted on their web site.

It worked fine but I didn't like the advertisements that response-o-matic put on my web site so I decided to use a FormMail perl CGI script from scriptarchive.com (installed locally) instead and I put this script in my cgi-bin folder which is in my webspace as well as my web page. I then configured the script.

But when I tested out the online form by writing myself a message, it went through the proper motions as expected without apparent errors but I didn't receive the email, plus I got an error from the Apache log file saying "sendmail: Cannot open mail:25".

I've checked all of the most obvious settings like #!/usr/bin/perl at the top of the script to make sure it sees the perl program and I've checked to make sure it sees my sendmail program in /usr/lib/sendmail and it does.

So these are the facts I know: 1) My email program works fine when used normally outside of my webspace and 2) The PHP formmail script works fine when I use it from response-o-matic.com. 3)My formmail script will not work when I use the CGI formmail script locally. I'm pretty sure I've got the CGI script configured correctly since it doesn't give any error messages.

In otherwords, if the script is accessed from the Internet such as the case with response-o-matic, it works fine but when the script is accessed locally (in my cgi-bin folder), I get no email plus the error message.

This subject can get very complicated for a newbee like myself but what would be the most obvious thing for me to look for?

Regards,

RoyLast edited by rrrssssss on Sun Jun 29, 2008 7:07 pm; edited 1 time in total

----------

## comprookie2000

Have you tested and setup sendmail?

----------

## rrrssssss

Upon further inverstigation, I discovered I don't have Sendmail installed at all. I have sSMTP installed with a link called "sendmail".

I would rather keep sSMTP if possible.

I noticed if I use this command as root:   echo 'hi' | sendmail 'test' myemail@provider.com    I get the same error message as I get in my original post saying "sendmail: Cannot open mail:25".

Keep in mind that my email reader, Mozilla Thunderbird, receives email with no problem and I'm assuming it is using sSMTP/sendmail as well. I don't have any other MTAs on my computer as far as I know.

Regards,

Roy

----------

## comprookie2000

Your email reader (Thunderbird) is most likely set up with your isp's server. Most isp's will not relay mail from your web server. I use msmtp;

```
ibm david # ls -l /usr/sbin/sendmail

lrwxrwxrwx 1 root root 14 Apr 21 08:26 /usr/sbin/sendmail -> /usr/bin/msmtp

```

This is how I set it up so my isp will relay my system mail;

```

ibm david # cat /etc/msmtprc

account default

host mail.myisp.net

auto_from on

maildomain myisp.net

syslog LOG_MAIL

```

Does that make any since?

----------

## rrrssssss

Hello comprookie2000,

Yes, you are making sense and I appreciate your help. You gave me more insight as to what my problem was. In otherwords, I finally got it to work!

I decided to keep sendmail (which is really ssmtp with a symbolic link called sendmail) and I Googled a little more and I edited only 2 lines in my /etc/ssmtp/ssmtp.conf file.

1) mailhub=the name of my outgoing mail server provided by my ISP, which is the same name I used when I configured Thunderbird, by the way.

2) rewriteDomain=the name of my website minus the http:// part.

I left all of the other entries at the default settings.

Now I am able to use my online form and have it sent to any of my email addresses that I choose.

Linux is fun,

Roy

----------

## comprookie2000

WOW,    :Smile:   It took me forever to get it working, plus I didn't know I could have used ssmtp. Put solved next to the title so when the search function on these forums start working again, (I get a blank page) others will benefit your detective work.

----------

