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 = 'wesley_pipes_@hotmail.com' ;
$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: noreply@YourCompany.com";
$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 webmaster@YourCompany.com"; }
}
}
?>
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.