Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Sending mail from a server when PHP Mail is disabled



5:42 am on Sep 15, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

I am having serious trouble with sending mail from the server for my web site, because the hosting company has disable PHPMail. Is there anyway to get around this? And what is the best and easiest solution?


5:49 pm on Sep 16, 2011 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member

You can use gmails servers. If you don't have an account, just create one. Download this class here
and then use this code
$mail = new PHPMailer();
$mail->IsSMTP(); // send via SMTP
IsSMTP(); // send via SMTP
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "username@gmail.com"; // SMTP username
$mail->Password = "password"; // SMTP password
$webmaster_email = "username@doamin.com"; //Reply to this email ID
$email="username@domain.com"; // Recipients email ID
$name="name"; // Recipient's name
$mail->From = $webmaster_email;
$mail->FromName = "Webmaster";
$mail->WordWrap = 50; // set word wrap
$mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment
$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // attachment
$mail->IsHTML(true); // send as HTML
$mail->Subject = "This is the subject";
$mail->Body = "Hi,
This is the HTML BODY "; //HTML Body
$mail->AltBody = "This is the body when user views in plain text format"; //Text Body
echo "Mailer Error: " . $mail->ErrorInfo;
echo "Message has been sent";

Featured Threads

Hot Threads This Week

Hot Threads This Month