Set up SMTP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
renaxgade
Forum Newbie
Posts: 17
Joined: Wed Oct 29, 2003 4:02 pm

Set up SMTP

Post by renaxgade »

How do I set up my smtp server? I have apache 2 and php installed and they work, but when I try to use mail () to send a message, that im sure should work, it doesnt send, and I never configured any files, so Im guessing thats it. How do I do it?
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

As far as I know you need to install a mail server as well so that your computer is running as a POP3 and/or SMPT server.

Try searching Yahoo or Google.
Cruzado_Mainfrm
Forum Contributor
Posts: 346
Joined: Sun Jun 15, 2003 11:22 pm
Location: Miami, FL

Post by Cruzado_Mainfrm »

if u have win9x/2k/xp u can install IIS and set up the SMTP server it has
if u have unix u can use an app called Qmail i think... or something like that(i've never used unix)

after u set up the smtp server, u have to configure the php.ini file and set there the smtp directives...
renaxgade
Forum Newbie
Posts: 17
Joined: Wed Oct 29, 2003 4:02 pm

Post by renaxgade »

This is Linux, and I have sendmail installed and turned on. But when I try to send an e-mail through a form that looks like this:

Code: Select all

<form method="POST" action="Mail.php>
Name: <input type="text" name="name"><br>
Screen Name <input type="text" name="sn"><br>
<input type="submit" value="submit"></form>
Mail.php

Code: Select all

<?php
$to = "Joey<**@*****.net>";
$subject = "Icon Form";
$body = $name + "\n\r" + $sn;
$from = "From: Joey<Website@come.com>\n";
$headers = $from;
mail($to, $subject, $body, $headers);


?>
Now I have no idea if my smtp server or however the mail is set up to go out of works. I don't really know what im doing, but I started sendmail in my init.d directory. Do I have to do anything in httpd.conf or php.ini
Cruzado_Mainfrm
Forum Contributor
Posts: 346
Joined: Sun Jun 15, 2003 11:22 pm
Location: Miami, FL

Post by Cruzado_Mainfrm »

try changing:
to = "Joey<**@*****.net>";

to

to = "**@*****.net";

and test it
renaxgade
Forum Newbie
Posts: 17
Joined: Wed Oct 29, 2003 4:02 pm

Post by renaxgade »

Nope. Are you sure there isnt anything in any configuration files I have to edit?
Cruzado_Mainfrm
Forum Contributor
Posts: 346
Joined: Sun Jun 15, 2003 11:22 pm
Location: Miami, FL

Post by Cruzado_Mainfrm »

did u configure your php.ini file to work with your smtp server?
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Did you put your sendmail path in the php.ini?

Mac
renaxgade
Forum Newbie
Posts: 17
Joined: Wed Oct 29, 2003 4:02 pm

Post by renaxgade »

I don't think so. How do I?
renaxgade
Forum Newbie
Posts: 17
Joined: Wed Oct 29, 2003 4:02 pm

Post by renaxgade »

I think I did, or it was automatic, because It says this in php.ini:
; For Unix only. You may supply arguments as well. (default: "sendmail -t -i").
sendmail_path = /usr/sbin/sendmail - t -i

Now I looked in that folder and saw sendmail. Maybe sendmail isn't working for soem reason? It's turned on. Or it still could be a problem with the script.
renaxgade
Forum Newbie
Posts: 17
Joined: Wed Oct 29, 2003 4:02 pm

Post by renaxgade »

BUMP. Anyone have any ideas, Im stumped!
Post Reply