SMTP question (no, not that one)
Posted by: Josh (164.111.20.---)
Date: June 18, 2007 11:18PM

Greetings. I've researched several e-mail threads on this forum. Hopefully this is no re-hash.

What I've installed;

Windows server with SMTP enabled.
WAMP
PHP script that uses the mail function.

This is for internal use on our relatively small network. My question is with a local (same box as WAMP install) SMTP server configured to send mail, is there anything configuration wise that I need to set up other than specifying the SMTP address in the mail function and mail address fields of the PHP.ini file? Everything is as default otherwise. I don't seem to recieve the e-mails that are being generated by the PHP script. I just would like to verify that this the correct configuration and that I'm not missing something simple.

If this fails I'll have to try the phpmailer route, although it might be a bit too involved for my skills.

Thanks.



Post Edited (06-18-07 23:36)

Options: ReplyQuote
Re: SMTP question (no, not that one)
Posted by: CyberSpatium (71.237.217.---)
Date: June 19, 2007 05:05AM

you cannot connect to an smtp server and send email using the mail() and imap_mail(). you will have to connect to your smtp server using fsocketopen, setup a stream and then send emails through that. it takes some very advanced php coding skills to acomplish that task. i suggest you use phpmailer. all the hard part is taken care of by the class. for example, i did not want to write a complicated php script just to handle a simple contact forum on my website clarifyloans.com. so, i just uploaded the class to my website, and add this code:


$mail = new PHPMailer();

$mail->IsSMTP(); // send via SMTP
$mail->Host = $settings['smtpserver']; // SMTP servers
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = $settings['user']; // SMTP username
$mail->Password = $settings['password']; // SMTP password

$mail->From = $emailaddr['post'] ;
$mail->FromName = "Clarify Loans Contact Form";
$mail->AddAddress($settings['adminemail'],"John Phillips"winking smiley;
$mail->AddReplyTo($settings['adminemail'],"Information"winking smiley;

$mail->WordWrap = 50; // set word wrap
$mail->IsHTML(false); // send as HTML

$mail->Subject = $subj['post'];
$mail->Body = $message['post'];
$mail->AltBody = $message['post'];

if(!$mail->Send())
{
echo "Message was not sent <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}

echo "Message has been sent";


this is way easier than write a code to connect to smtp server.



CyberSpatium
----------------------
WAMP English Forum Admin

Need help? Check out my WAMP User Manual/Guide here!


Cellular Phone Deals - The Best on the Net! - FREE PHONES! Take your pick from our featured cellular phone deals by Cingular, Verizon, T-Mobile, Sprint PCS, Nextel, and more! Most of our cellular phone offers include a FREE cellular phone with FREE shipping!


Web Development for Newbie's Blog - Check out my new blog. It is for web developers, and especially tailored for the web development newbie. If you are not fluent in “geek speak”, then this incredible resource is just you. And even if you are a web development pro, this is a great resource to check out some of the latest web development tips, news, tutorials, codes and more.


Mortgage and Home Loan Advice:
Clarify Loans

Options: ReplyQuote
Re: SMTP question (no, not that one)
Posted by: Josh (---.pix.hs.uab.edu)
Date: June 19, 2007 04:44PM

I appreciate the help. The last thing I want to do is get into complicated code. Does the code you listed for phpmailer go into the class file or does it get added to each php script file that generates e-mail? That's probably the step I'm not quite seeing (how the script uses the phpmailer file).

Again, thanks for pointing out that SMTP is not really simple all the time. smiling smiley

-Josh

Options: ReplyQuote
Re: SMTP question (no, not that one)
Posted by: CyberSpatium (71.237.217.---)
Date: June 21, 2007 01:49PM

I include the phpmailer class file, then initialize the class. then i process the contact form and finally send the email using the code above.


CyberSpatium
----------------------
WAMP English Forum Admin

Need help? Check out my WAMP User Manual/Guide here!


Cellular Phone Deals - The Best on the Net! - FREE PHONES! Take your pick from our featured cellular phone deals by Cingular, Verizon, T-Mobile, Sprint PCS, Nextel, and more! Most of our cellular phone offers include a FREE cellular phone with FREE shipping!


Web Development for Newbie's Blog - Check out my new blog. It is for web developers, and especially tailored for the web development newbie. If you are not fluent in “geek speak”, then this incredible resource is just you. And even if you are a web development pro, this is a great resource to check out some of the latest web development tips, news, tutorials, codes and more.


Mortgage and Home Loan Advice:
Clarify Loans

Options: ReplyQuote


Sorry, only registered users may post in this forum.