Technical Problem

ID #1309

i tested a feedback form using PHP mail functions on my clients account on your webserver but it didn't work. Does your webserver support sending e-mail via PHP?

Linux hosting doesn't allow direct mail sending through PHP mail() function. In order to send email through PHP mail() function, you need to be authenticate first by the SMTP server. Simplest way to do is to use the PHPMailer. Below is the sample  php code using PHPMailer.

 

<?php

  include("class.phpmailer.php");
  $mail = new PHPMailer();
  $mail-> IsSMTP();
  $mail->Host = "mail.yourdomain.com";
  $mail->SMTPAuth = true;
  $mail->Username = "youruseremail@yourdomain.com";
  $mail->Password = "yourpassword";
  $mail->From = "youremail@yourdomain.com";
  $mail->FromName = "YourName";
  $mail->AddAddress($To-EmailAddress);
  $mail->AddReplyTo("youremail@yourdomain.com", "YourName");
  $mail->IsHTML(true);
  $mail->Subject = "subject is here";
  $mail->Body = "full body message here";
  $mail->AltBody = "full body message same here";

   if(!$mail->Send())
    {
       $Confirm = "Error in sending!  Message hasn't been sent";
    }
  else
   {
      $Confirm = "Message has been sent";
    }
?>

Tags: -

Related entries:

Last update: 2007-12-11 01:41
Author: Philhosting
Revision: 1.0

Digg it! Print this record Send to a friend Show this as PDF file
Propose a translation for Propose a translation for
Please rate this entry:

Average rating: 2 out of 5 (2 Votes )

completely useless 1 2 3 4 5 most valuable

You can comment on this entry

Comment of randy:
here are my codes:
Added at: 2008-02-06 00:11