Sendmail Server for WAMP5
Posted by: lowell (---.asm.bellsouth.net)
Date: November 15, 2008 11:58PM

Does anyone know if the fake sendmail server at [glob.com.au] is safe to use? I'm new to sending email via the PHP mail function, but I have discovered it doesn't work with WAMP unless I also have a sendmail server.

Re: Sendmail Server for WAMP5
Posted by: toivo (---.nsw.bigpond.net.au)
Date: November 16, 2008 01:45AM

You do not need a sendmail server, as long as the SMTP entry in php.ini points to an email server, either your ISP's outgoing mail server which you normally use from your site or something else. If your application has different options, do not select sendmail but SMTP, and the default IP address or domain from php.ini will be used.

If you plan to allow public users to fill in forms, make sure you have done research about 'mail injection', 'SQL injection' 'PHP security'. Unless your application scrubs every input variable clean of malicious code before it passes them to the mail() function or MySQL statements, you would have to kiss your server goodbye because it would easily get 0wn3d...

Regards,

toivo
Sydney, Australia

Re: Sendmail Server for WAMP5
Posted by: lowell (---.asm.bellsouth.net)
Date: November 16, 2008 02:18AM

I'm using this strictly as a development platform on my PC right now. I will transfer it to a live web server, once i have everything working on the development platform. I do have code to scrub the form input I'll get when the site goes live.

I've tried setting php.ini but I get an error message. Here is how I have the [Mail Function] set in php.ini, with the private stuff replaced by generic terms:

[mail function]
; For Win32 only.
SMTP = mail.bellsouth.net
smtp_port = 25
default_domain=bellsouth.net
auth_username=myusername - I have also tried myusername@bellsouth.net
auth_password=mypassword
sendmail_from = myusername@bellsouth.net

The error message I get is:

E_Warning
mail()[<a href='function.mail>function.mail</a>confused smileyMTP Server Response: 501 need user@domain at
&lt;myusername%40bellsouth.net&gt;

followed by the line number in my PHP script where the error occurs.

The lines in my PHP script are:

$encoded_email = urlencode($_POST['user_name']);

$mail_body = <<< EOMAILBODY
Thank you for registering at Example.com. Click this link to confirm your registration:
[localhost]
Once you see a confirmation message, you will be logged into
Example.com
EOMAILBODY;

mail ($encoded_email, 'Example.com Registration Confirmation', $mail_body, 'From: myusername@bellsouth.net');

It seems I'm reaching my ISP's SMTP server, but something is going wrong at that point.

Any ideas? Should the value to the right of the equal signs in php.ini be enclosed in quotes?

Thanks,
Lowell

Re: Sendmail Server for WAMP5
Posted by: lowell (---.asm.bellsouth.net)
Date: November 16, 2008 04:54PM

I solved it. The error was due to the code

$encoded_email = urlencode($_POST['user_name']);

urlencoding places the %40 in the recipient EM address so that it reads myusername%40bellsouth.net.

Email now works as expected.

Lowell

Sorry, only registered users may post in this forum.