Posted on: 08/28/02 06:01pm
By: Anonymous (Anonymous)
The smtp server I use for php requires authentication - how do I set up the username and password...
Or am I missing the bigger picture??
Thanks, Alex Kerin
SMTP Authentication Required Mail Server
Posted on: 08/22/03 06:37pm
By: emagin
I have the same problem.
My mail server requires authentication to send mail.
All my Geeklog initiated mail sessions end with errors:
PHP Warning: mail(): SMTP server response: 530 Authentication required in ...public_htmladminmail.php on line 183, referer: http://.../admin/mail.php
Re:SMTP auth
Posted on: 08/23/03 12:34am
By: LewisR
For authenticated SMTP, you\'ll need to reconfigure sendmail (or whatever MTA you\'re using. The PHP mail function merely passes the data to the external app; it has no provision for special SMTP functions.
For sendmail, you\'ll want to probably make entries to the following:
In your sendmail.cf (or .cf8), you\'ll want to be sure to use the DefaultAuthInfo directive, and set it to point to the file containing your authentication data, usually, /etc/sendmail/default-auth-info (but it can be anywhere in the filesystem).
The file default-auth-info needs to have something similar to the following:
AuthInfo:smtp.domain.com \"U:username\" \"P=password\"
Now, when you pass your mail to your gateway (the above configuration assumes you\'re using sendmail in \"dumb\" mode, simply passing mail to another SMTP server for processing), as defined by \"smtp.domain.com\" (you\'ll need this to be the gateway server defined in sendmail.cf as your smart relay host, via the DS directive), it will reference the username & password defined in default-auth-info, and your mail should go through.
HTH
Re:SMTP authentication required
Posted on: 08/23/03 12:51pm
By: emagin
Pardon me, I\'m using windows and have not been able to find sendmail.cf anywhere.
Is there any chance you could elaborate on this. Sorry if this is a dumb question, but I have little clue sa to where this stuff is.
I have a sendmail.dll in my /winnt/ directory, but that\'s it.
This is the only thing holding back my Geeklog site launch!
Re:SMTP auth
Posted on: 08/25/03 03:46am
By: emagin
I\'ve found
PHP Mailer which seems to offer everything that PHP (mail) does not have.
As a PHP newbie, I\'m surprised at how weak mail is in PHP.
An example below lets you set SMTP Authentication fine.
I\'ve tested it and it works with my servers.
However, I have no idea where to start taking apart /admin/mail.php and other files. It\'s too complex for me to get straight.
Can anyone out there help out? For now all I care about is letting users register and receive their PW via email, and forum alerts (although this is optional!).
Thanks
========================================
require(\"class.phpmailer.php\");
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = \"smtp1.example.com;smtp2.example.com\"; // specify main and backup server
$mail->SMTPAuth = true // turn on SMTP authentication
$mail->Username = \"jswan\" // SMTP username
$mail->Password = \"secret\" // SMTP password
$mail->From = \"from@example.com\";
$mail->FromName = \"Mailer\";
$mail->AddAddress(\"josh@example.net\", \"Josh Adams\");
$mail->AddAddress(\"ellen@example.com\"); // name is optional
$mail->AddReplyTo(\"info@example.com\", \"Information\");
$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->AddAttachment(\"/var/tmp/file.tar.gz\"); // add attachments
$mail->AddAttachment(\"/tmp/image.jpg\", \"new.jpg\"); // optional name
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = \"Here is the subject\";
$mail->Body = \"This is the HTML message body
in bold!\";
$mail->AltBody = \"This is the body in plain text for non-HTML mail clients\";
if(!$mail->Send())
{
echo \"Message could not be sent.
\";
echo \"Mailer Error: \" . $mail->ErrorInfo;
exit;
}
echo \"Message has been sent\";
?>
Re:SMTP auth
Posted on: 08/25/03 10:21am
By: Euan
The mail is actually sent with line 182-183:
if ( !mail($A[\'email\'], stripslashes ( $vars[\'subject\'] ),
stripslashes ( $vars[\'message\'] ), $headers) ) {
$failures[] .= $til;
} else {
$successes[] = $til;
}
The mail headers are contained in $headers, the \"to\" address in $A[\'email\'], the subject in $vars[\'subject\'], and the body in $vars[\'message\']. With that, you should be able to make the PHP mailer script work.
Cheers,
Euan.
Re:SMTP auth
Posted on: 08/25/03 12:18pm
By: akerin
As a followup to my story (of almost a year ago!), I could use the SMTP of my ISP without authorization. Problem Solved.
Alex
Re:SMTP auth
Posted on: 08/27/03 01:49pm
By: emagin
Ok I am not quite there yet, but this hack and explanation at
LocalSteve\'s site is it.
PLEASE NOTE - Dirk is currently working on a similar Pear implementation for GL, so you may want to see what the status is there before embarking on this one.
As soon as I get it working I\'ll report back.
(and take heart you non-coders, I\'m fairly clueless and making good progress!)
Re:SMTP auth
Posted on: 09/21/03 11:38pm
By: xspace
Hope to see some good instructions for Windows users ... I am also running in on windows locally for a group of internal users.
Re:SMTP auth
Posted on: 09/22/03 12:10am
By: emagin
Hate to tell you this but I spent a couple hours messing with this in Windows. I went to the Pear binaries downloads, got the latest install, and ran the .bat file to install for win32.
That seemed to work ok.
Then I pointed the various pear paths to c:/php/pear/mail/... etc. (win32 only!) and set that up properly.
But I couldn\'t get it to work. I got some errors and gave up.
I\'m sort of hoping Dirk\'s Pear implementation will come out soon, although I think he got a new job so that might not happen.
Re:SMTP auth
Posted on: 09/22/03 03:17am
By: destr0yr
I downloaded the nightly CVS of geeklog and it seems to work fine with smtp auth... however, its probably not something that they would fully support as its in development and it would be fun upgrading when gl 1.3.9 comes out.. (just a guess @ version #)
Re:SMTP auth
Posted on: 09/23/03 11:19am
By: DTrumbower
[QUOTE BY= destr0yr] I downloaded the nightly CVS of geeklog and it seems to work fine with smtp auth... however, its probably not something that they would fully support as its in development and it would be fun upgrading when gl 1.3.9 comes out.. (just a guess @ version #)[/QUOTE]
Do you have a support contract?

If its in CVS, you surely can use it and ask questions about it. Maybe the response might be slower because more debuging might be needed to answer the question. But there is nothing wrong with more people using/testing cvs. Just realize that it could have some problems. But since Dhaun coded it, probably not.
Re:SMTP auth
Posted on: 09/23/03 03:33pm
By: Dirk
[QUOTE BY= DTrumbower]But there is nothing wrong with more people using/testing cvs.[/QUOTE]
Yep. That counts as one way to
help Geeklog.
[QUOTE BY= DTrumbower]Just realize that it could have some problems.[/QUOTE]
... or that incompatible changes (in code or in the database) could happen, usually without a warning (also see the \"General Notes\" on the
CVS page).
bye, Dirk