[REV] Alternative to 'fake sendmail' - PHP Mailer Class -

Problems with the Windows version of XAMPP, questions, comments, and anything related.

[REV] Alternative to 'fake sendmail' - PHP Mailer Class -

Postby Nobbie » 06. March 2013 13:01

Edit by Altrea 2013-12-04:
Will be revised / merged / structured


Instead of "fiddling around" with a Fake Sendmail (in order to get the poor PHP API mail() Function working), i definately recommend the usage of the Phpmailer Class instead: http://sourceforge.net/projects/phpmailer/

It is easy to use, and (as a nice side effect) it does not only deliver emails quickly and easily, it also supports multipart mime emails (embedded grafics etc.) including HTML emails.

You may use this mailX() function (instead of mail()) as an easy kick-off. There is no Fake Sendmail required:

Code: Select all
<?php

include("class.phpmailer.php");
include("class.smtp.php");

function mailX($to, $subject, $message, $from) {

   $mail         = new PHPMailer();

   $mail->IsSMTP();
   $mail->SMTPAuth      = true;
   $mail->SMTPSecure   = "ssl";
   $mail->Host         = "smtp.yoursmtp.de";   /* your smtp server etc. */
   $mail->Port         = 587;               /* SMTP Port */
   $mail->Username      = "youruserid";         /* SMTP UserID */
   $mail->Password      = "yourpasswd";         /* SMTP Password */

   $mail->AddAddress($to, '');
   $mail->Subject      = $subject;
   $mail->Body         = $message;
   $mail->From         = $from;   /* replace optional by default email */
   $fromname         = '';      /* replace optional by any name */
   $mail->FromName      = $fromname;
   $mail->AddReplyTo($from,$fromname);

   $res = $mail->Send();

   if(!$res) {
     echo "Mailer Error: " . $mail->ErrorInfo;
   }

   return $res;
}
?>
Nobbie
 
Posts: 13165
Joined: 09. March 2008 13:04

Re: Alternative to 'fake sendmail' - PHP Mailer Class -

Postby CraftyMc » 19. June 2013 02:36

how would you make it the default mailing system? It works fine when I run a test script from my htdocs but when I try to use a module in joomla or when I use the 'email' function in phpbb3 nothing comes through, the emails don't arrive?
CraftyMc
 
Posts: 13
Joined: 18. June 2013 20:11
Operating System: Windows 7


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 144 guests