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 = '[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 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 [email protected]"; } }}?> Link to comment https://forums.phpfreaks.com/topic/25854-is-there-anything-wrong-with-this-mail/ 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 Link to comment https://forums.phpfreaks.com/topic/25854-is-there-anything-wrong-with-this-mail/#findComment-118106 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 Link to comment https://forums.phpfreaks.com/topic/25854-is-there-anything-wrong-with-this-mail/#findComment-118121 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 Link to comment https://forums.phpfreaks.com/topic/25854-is-there-anything-wrong-with-this-mail/#findComment-118125 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.