wesleypipes Posted November 1, 2006 Share Posted November 1, 2006 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 anymore 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"; } }}?> Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted November 1, 2006 Share Posted November 1, 2006 The default mail() function does not do SMTP authentication. You should look at the [url=http://phpmailer.sourceforge.net/]PHPmailer[/url] class.Ken Quote Link to comment Share on other sites More sharing options...
wesleypipes Posted November 1, 2006 Author Share Posted November 1, 2006 ok thanks ken - would i have to change the code alot to make it work with phpmailer Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted November 1, 2006 Share Posted November 1, 2006 You would have to do some changes. Read the documentation.Ken Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.