Question:
How do I email a form in PHP?
Riley
2011-06-14 18:57:34 UTC
Hi. Im trying to figure out how to setup a email form in PHP. I have everything setup but I keep getting a error called SMTP server response: 530 SMTP authentication is required. in C:\wamp\www\Index.php on line 13. The coding on line 13 thats giving me the error is

$success = mail($webMaster, $Subject, $body, $headers)

Here is all the coding..

$Subject = 'User Control Password';
$webMaster = 'riri321@yahoo.com';
$email = 'rileykconverse@gmail.com';

$Username = $_POST['Username'];
$Password = $_POST['Password'];

$body = <<



Username: $Username

Password: $Password

EOD;

$headers = "From: $email\r\n";
$headers .= "Content=type: text/html\r\n";
$success = mail($webMaster, $Subject, $body, $headers);

?>



Username:

Password:






I saved this as Index.php

Can someone please tell me what I'm doing wrong.
Three answers:
Captn.Jack sparrow
2011-06-14 21:50:21 UTC
Mail function will not work on localhost,
Manuel Lemos
2011-06-16 01:46:14 UTC
PHP on Windows does not support sending messages via SMTP servers that require authentication.



I have developed an alternative solution that consists in replacing the mail function by another named smtp_mail which takes the exact same parameters but can send messages via an SMTP server and lets you set the user name and password to relay messages to that server.



Just download the following packages below and take a look at the test_smtp_mail.php example script.
anonymous
2011-06-16 03:31:33 UTC
Funciona sim, usando o sendmail em conjunto com um servidor smtp externo tipo o Gmail ou o Hotmail...



No meu blog tem la dois tutoriais ou artigos como queira chamar, onde explico como fazer, são eles:



Com o The Uniform Server: http://vitorteixeira.co.cc/completo-servidor-localhost-no-windows



Usando o xampp: http://vitorteixeira.co.cc/como-instalar-o-xampp



É simples de configurar, e é muito útil para quem trabalha em localhost...



Um abraço...



Edite: Reparei agora que usa o wamp, e a mesma coisa como Xampp, só muda as pastas, se tiver dificuldade, escreva aqui ou no blog, que eu explico...


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...