Jump to content

Is there anything wrong with this mail()


wesleypipes

Recommended Posts

Basically user enters in details through a form. Afterwards, emails are sent. The php code is below. Im using my isp for that smtp stuff which requires a pass. Anyway, once i subit the form, i get a'530 authentication required - Your email could not be sent. To fix this you must make a simple change to your email (known as SMTP authentication).' Is there a way to overcome this?

<?php
$to = '[email protected]' ;
$from = $_REQUEST['email'] ;
$name = $_REQUEST['name'] ;
$message = $_REQUEST['message'] ;
$headers = "From: $from";
$subject = "Web Contact Data";

$fields = array();
$fields{"name"} = "Name";
$fields{"message"} = "Comments";
$fields{"email"} = "Email";


$body = "We have received the following information:\n\n"; foreach($fields as $a => $b)
{ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }


$headers2 = "From: [email protected]";
$subject2 = "Thank you for contacting us";
$autoreply = "Thank you for contacting us.Somebody will get back to you as soon as possible, usualy within 48 hours. If you have any
more questions, please consult our website at www.oursite.com";


if($from == '') {print "You have not entered an email, please go back and try again";}
else {
if($name == '') {print "You have not entered a name, please go back and try again";}
else {

$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
if($send)
{header( "Location: http://www.YourDomain.com/thankyou.html" );}
else
{print "We encountered an error sending your mail, please notify [email protected]"; }
}
}
?>
Link to comment
https://forums.phpfreaks.com/topic/25854-is-there-anything-wrong-with-this-mail/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.