Page 1 of 1

SMTP Authentication

Posted: Wed Apr 05, 2006 8:55 am
by engert100
feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi everyone.

I'm am using a php contact form in my website, which i got from [url=http://www.syndikut.pwp.blueyonder.co.uk/free.htm]here[/url]. Demo [url=http://www.syndikut.pwp.blueyonder.co.uk/free/mailme/email.php]here[/url]. It is working fine, except that when you hit submit it gives me this error:

Code: Select all

Warning: mail(): SMTP server response: 503 This mail server requires authentication. Please check your mail client settings. in c:\inetpub\wwwroot\offline\email.php on line 54
I checked line 54 and it looks like this:

Code: Select all

$send = mail( $to, $subject, $message, "From: {$from}");
Now my question is: What smtp authentication code should i add in this line (or another line) so i can put the name of my SMTP server, Username and Password?

Any help is appreciated.

Thank you.


feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Wed Apr 05, 2006 9:56 am
by ed209
Not sure if this is any use, but I stumbled across it the other day http://uk.php.net/manual/en/ref.mail.php#39305

Posted: Wed Apr 05, 2006 1:19 pm
by engert100
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


And how could i code that into my file? Would it be something like this:

Code: Select all

$send = mail( $to, $subject, $message, "From: {$from}");  
$params["host"] = "smtp.server";
$params["port"] = "25";
$params["auth"] = true;
$params["username"] = "user";
$params["password"] = "password";

Would that work?


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Wed Apr 05, 2006 1:25 pm
by feyd
be extremely careful in passing header information to mail(), you could fall victim to header injection (a.k.a. spammer paradise)

Have a read through the security section to understand how to protect your scripts from it.

Posted: Wed Apr 05, 2006 1:29 pm
by engert100
Thank you feyd.

Would this page be a good recource for mail protection: http://www.phparch.com/phpsec/ ?

Posted: Wed Apr 05, 2006 1:37 pm
by feyd
I was speaking more specifically look through here. But php|architect is also a good resource to look through.