amitkpt Posted July 24, 2008 Share Posted July 24, 2008 Hi All, I am new to PHP. While create a web site in PHP, I have a strange problem. I am using pear php to send mails with smtp authentication. I also created small user authentication with mysql. I have a script to send mails. Problem is I am getting errors while sending mail from all users accept one. I mean it can only send mails with user (amit i.e me). I don't know where is the problem is it in the srcipt or in configuration. Because if the problem is in configuration then why it is allowing one user to send mails? I am coping the script below. I am using below function. <?php session_start(); include("templates.php"); do_html_header("Spicy Voting! Create New Poll."); datab(); ?><div id="content"><? check_valid_user(); require_once "Mail.php"; $email = $_POST['email']; $id = $_POST['id']; $user = $_SESSION['vname']; @extract($_GET); if($email) { $recipients = $email; $headers["From"] = $user; $headers["To"] = $email; $headers["Subject"] = "I created a new poll. Please cast your vote."; $mailmsg = "Hi, I just created new poll in spicyvoting.com. Please try and cast your vote and see interesting results. Also you can post your own new polls there. This is very interesting to know about thinking of different people and polling is best why to know this. Here we can make our own new polls and send that to people to know what they think? I found that very interesting. Please try that. Please follow this link to cast your vote in my poll. http:spicyvoting.com/polls_id.php?id=".$id." To know more about spicyvoting visit. www.spicyvoting.com or Email: [email protected]"; /* SMTP server name, port, user/passwd */ $smtpinfo["host"] = "mail.spicyvoting.com"; $smtpinfo["port"] = "25"; $smtpinfo["auth"] = true; $smtpinfo["username"] = "[email protected]"; $smtpinfo["password"] = "**********"; /* Create the mail object using the Mail::factory method */ $mail_object =& Mail::factory("smtp", $smtpinfo); /* Ok send mail */ $mail = $mail_object->send($recipients, $headers, $mailmsg); if (PEAR::isError($mail)) { echo("<p>" . $mail->getMessage() . "</p> <a href='javascript: history.go(-1)'>Back</a>"); } else { echo("<div align='center'><p>Your invitation is sent to ".$email."</p></div>"); } } else { ?> <form action="<? $_SERVER['PHP_SELF']; ?>" method='post'> Email ID of your friend: <input type="text" name="email"> <p> <input type="submit" value="Invite"> </form> <? } ?></div><? do_html_footer(); ?> I am getting following error while not sending the mail: Failed to add recipient: [email protected] [sMTP: Invalid response code received from server (code: 550, response: Verification failed for Unrouteable address Sender verify failed)] Please reply as soon as possible. Thanx in Advance Link to comment https://forums.phpfreaks.com/topic/116462-not-able-to-send-mails-with-script/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.