[dokuwiki] Re: Sendmail -- do I have too? WAAAH!

  • From: Chris Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Tue, 18 Oct 2005 11:52:10 +0100

Hi,

It isn't that difficult to replicate php's mail function using socket functions (see bottom of this mail), or as Joe suggested phpmailer, which would break Dokuwiki's dependence on the php's own mail function and allow those mail based features to operate in intallations where the admin either doesn't have control over smtp or doesn't have the skill to set it up.

Perhaps Joe could prepare an article or patch set on switching from mail to phpmailer. :)

Dokuwiki only calls mail() in two places, so even if the main code base isn't changed instructions on using another mechanism shouldn't be too complex.

fwiw, I use ssmtp. Its installation/configuration couldn't be simpler. And if you run a linux server having some form of mail transport is useful for a lot of other things besides dokuwiki (e.g. cron jobs).

Chris

A simple mail function using sockets - I can't remember the source

function SendMail($ToName, $ToEmail, $FromName, $FromEmail, $Subject, $Body, $Header)
{
$SMTP = fsockopen("smtp.sitename.com", 25);


$InputBuffer = fgets($SMTP, 1024);

fputs($SMTP, "HELO sitename.com\n");
$InputBuffer = fgets($SMTP, 1024);
fputs($SMTP, "MAIL From: $FromEmail\n");
$InputBuffer = fgets($SMTP, 1024);
fputs($SMTP, "RCPT To: $ToEmail\n");
$InputBuffer = fgets($SMTP, 1024);
fputs($SMTP, "DATA\n");
$InputBuffer = fgets($SMTP, 1024);
fputs($SMTP, "$Header");
fputs($SMTP, "From: $FromName <$FromEmail>\n");
fputs($SMTP, "To: $ToName <$ToEmail>\n");
fputs($SMTP, "Subject: $Subject\n\n");
fputs($SMTP, "$Body\r\n.\r\n");
fputs($SMTP, "QUIT\n");
$InputBuffer = fgets($SMTP, 1024);

fclose($SMTP);
}



--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: