My current project is a form that receives input from a user.
After I receive that data, I must send a warning/report to a few email addresses, including the user who inserted the data.
Almost everything is up and running, Apache, MySQL, PHP.
Now I never installed a mail server, to work with PHP so I'm kinda lost.
My employer has MS Exchange 2007 on his server installed. Should I use it, and how would I start to configure php to work with it? What do I need from the Exchange 2007 (parameters)?
If not, would you recommend installing a new mail server for just this purpose on the same machine that has Apache+MySQL+PHP?
I am more inclined to use the already present Exchange server, but I read at some online articles that it's not the easiest thing to configure.
UPDATE:
<?php
include("Mail/Mail.php");
/* mail setup recipients, subject etc */
$recipients = "[email protected]";
$headers["From"] = "[email protected]";
$headers["To"] = "[email protected]";
$headers["Subject"] = "User feedback";
$mailmsg = "Hello, This is a test.";
/* SMTP server name, port, user/passwd */
$smtpinfo["host"] = "mail.name.com";
$smtpinfo["port"] = "25";
$smtpinfo["auth"] = true;
$smtpinfo["username"] = "username";
$smtpinfo["password"] = "pass";
/* Create the mail object using the Mail::factory method */
$mail_object =& Mail::factory("smtp", $smtpinfo);
/* Ok send mail */
$mail_object->send($recipients, $headers, $mailmsg);
?>
Using this example above I can't send mail through Exchange 2007.
I get no errors output on the page, so I'm kinda lost. Don't know what is wrong.
UPDATE: Can anyone recommend a good mail server?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…