Forum Moderators: coopster

Message Too Old, No Replies

php mail()

Not sending the email

         

Knowles

5:22 pm on Sep 24, 2002 (gmt 0)

10+ Year Member



I am working on a form mail scrpt. Its every simple, name email and what your wanting to send. The problem is its never sending the email. PHPInfo displays SMTP as "localhost".

Here is the form:


<form action="email.php" id="Contact Us" name="Contact Us" enctype="text/plain" title="Contact Us" method="post">
Name:<input type="text" name="Name" /><br />
Email:<input type="text" name="Email" /><br />
<textarea cols="20" rows="5" name="Info"></textarea><br />
<input type="submit" name="Send" value="Send" /><input type="reset" name="Clear" value="Clear" />
</form>

And the mail() code is:


mail("email@domain.com", "Subject line", "$Name just
used the form.\n\n $Info", "From: $Email");

Can anyone see the reason why it wouldnt send the email out? Even if it wasnt receiving the varables from the form it should send it with out the varables no?

I am not receiving any kind of errors when going to email.php its parsing out the rest of the page just not sending the email.

Nick_W

5:24 pm on Sep 24, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Let me guess, Windows right?

Have a look in your php.ini and change the line that says something about SMTP (there is also some comments that it is for Win users) to point to your ISP's SMTP server and all will be groovy ;)

Nick

Knowles

5:31 pm on Sep 24, 2002 (gmt 0)

10+ Year Member



Actually no I can get it to work in windows not on linux. I wish it was as simple as that.

andreasfriedrich

5:42 pm on Sep 24, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Did you check your MTA´s log? Is it running? Did php try to send the mail? Try error_reporting (E_ALL);

Knowles

5:53 pm on Sep 24, 2002 (gmt 0)

10+ Year Member



Forgive my stupidity but what is the MTA log?

I dont have access to the php.ini file my error reporting is set to 2039 per phpinfo(). Thats the same as my local server (win) which is set to E_ALL.

andreasfriedrich

5:58 pm on Sep 24, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



MTA = Mail Transport Agent; usually sendmail

Did you try talking to the MTA as explained here [webmasterworld.com]?

Andreas

dingman

6:01 pm on Sep 24, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



perhaps the simplest check is to see if you have an MTA (Mail Transport Agent) running on localhost. If you can telnet to port 25 and get a connection, there is almost certainly an MTA there. If you can't, there almost certainly isn't. From a unix-type command line you can check with 'telnet hostname 25', or with the Windows telnet client I believe you can specify the port when you fill in the connection dialog.

If there is one there, the location of your logs depends on your configuration, but is likely in /var/log/<someplace obvious>. Mine is in /var/log/mail.log and /var/log/mail.err.

Knowles

6:21 pm on Sep 24, 2002 (gmt 0)

10+ Year Member



When I try to telnet into it it gives me "No connection could be made because the target machine actively refused it."

That means its not going to work huh?

dingman

9:37 pm on Sep 24, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yup. You need to either (a) install and activate an MTA on your web host or (b) reconfigure PHP to use another host for SMTP.

If you didn't know what was meant by the acronym MTA until it started getting thown around in this thread, option 'a' is probably not your best choice. Find out from your ISP or hosting provider where there is an SMTP server that will relay for the web server, and put that server's name in place of localhost for PHP to use as a mail server.

Knowles

1:45 am on Sep 25, 2002 (gmt 0)

10+ Year Member



I have put in a request with my Host to find out about SMTP and senmail.