I am having a really hard time trying to figure out how to mail a form via email. I have tried downloading class.phpmailer.php and make a phpmailer object as in previous posts, along with other variations of mail.php shown below.
<?php
require_once “/lib/phpmailer/class.phpmailer.php”;
$mail = new phpmailer();
$mail->IsSMTP();
$mail->Host = “mail.whatever.com”; // verify that this is correct host
$mail->Port = 25; // verify that this is correct port on mail host
$mail->Username = “username”; // your login name on the mail host
$mail->Password = “password”; // your password on the mail host
$mail->From = “
$mail->FromName = “Administrator”;
$mail->AddAddress(“
$mail->Subject = “Password Retrieval”;
$mail->Body = “Password is: aaaaaaaa”;
$result = $mail->Send();
if($result)
{
// it worked
}
else
{
// it didn’t work, $mail->ErrorInfo will have any error message from phpmailer
}
?>
AND I tried this
<?
include(“Mail.php”);
/* mail setup recipients, subject etc
$recipients = “
$headers[“From”] = “
$headers[“To”] = “
$headers[“Subject”] = “User feedback”;
$mailmsg = “Hello, This is a test.”;
/* SMTP server name, port, user/passwd
$smtpinfo[“host”] = “mail.whatever.com”;
$smtpinfo[“port”] = “25″;
$smtpinfo[“auth”] = true;
$smtpinfo[“username”] = “username”;
$smtpinfo[“password”] = “password”;
/* Create the mail object using the Mail::factory method
$mail_object =& Mail::factory(“smtp”, $smtpinfo);
/* Ok send mail
$mail_object->send($recipients, $headers, $mailmsg);
?>
Please help! I greatly appreciate it!