Simple Machines Community Forum

General Community => Scripting Help => Aiheen aloitti: Mastiff - elokuu 28, 2007, 08:54:44 IP

Otsikko: SMTP e-mail in PHP
Kirjoitti: Mastiff - elokuu 28, 2007, 08:54:44 IP
Hey, can someone point me in the right direction for sending SMTP e-mail from a PHP script.  I had it working using a package I found called "phpmailer", but it suddenly stopped working.  I don't know why.  But my SMF install is still sending E-mails.

So what's the trick?  I traced some of the source PHP files in SMF and see they are using a function sendmail(), but this must be something written for SMF, right?  Since in my options I selected to use SMTP.  I can't find the actual function.

Any advice would be great, I'm kind of frustrated.
Otsikko: Re: SMTP e-mail in PHP
Kirjoitti: margarett - elokuu 29, 2007, 10:35:23 AP
It could be that your host does not allow php mail function, that's why you are using SMTP in SMF...

You usually can send mail with something like:

$dest_mail = "[email protected]";
$from_mail = "[email protected]
$subject = "Your subject";

$text = "your text here";

mail("$mail_dest","$subject","$text","From: $from_mail");


We use this kind of script in our page and it works OK.
Otsikko: Re: SMTP e-mail in PHP
Kirjoitti: Mastiff - elokuu 29, 2007, 11:23:06 AP
Thanks.  yeah, I decided to go that route.  For some reason I had it in my head that my ISP wouldn't let me use plain old mail().  I was also confused about how to get the "from" name correct, but as you show, it goes in the $header spot (also, e.g. "Bob Jones <[email protected]>").

I still wish I knew why my SMTP worked and then stopped working.  I wonder if there is anti-spam protection that prevents too many E-mails form going out or something...