I have a registration forms which allows an user to register at my website a password gets generated automatically to the User's email ID. This works in my local server but when I host it in my client's server it fails. Only the email part fails. I checked the SMTP Server details and I am not positive if I am missing anything. My code is this:
<?PHP
function sendmail($name, $from, $to, $subject, $body, $html, $charset )
{
$smtp_server = "mail.domainname.com"; //enter your smtp server here
if (!$smtp_sock = fsockopen("$smtp_server", 25)) {
die ("Couldn't open mail connection to server! \n"); }
fputs($smtp_sock, "HELO $smtp_server\n");
fputs($smtp_sock, "VRFY $smtp_server\n");
fputs($smtp_sock, "MAIL FROM:<$from>\n");
fputs($smtp_sock, "RCPT TO:<$to>\n");
fputs($smtp_sock, "DATA\n");
fputs($smtp_sock, "From: $name($from)\n");
fputs($smtp_sock, "X-Mailer: emailer1.0\n");
if ($html)
fputs($smtp_sock, "Content-Type: text/html;");
else
fputs($smtp_sock, "Content-Type: text/plain;");
fputs($smtp_sock, "charset=$charser\n");
fputs($smtp_sock, "MIME-Version: 1.0\n");
fputs($smtp_sock, "Subject: $subject\n");
fputs($smtp_sock, "To: $to\n");
fputs($smtp_sock, "$body");
fputs($smtp_sock, "\n.\nQUIT\n");
fclose($smtp_sock);
}
?>
</body>
</html>
Thoughts/ideas
Thanks
Sri