I am trying to add some basic email functionality to a project. I have to use the gmail smtp because I want to be able to send it to myself. I get the follwoing errors
Quote
Warning: mail() expects at least 3 parameters, 2 given in C:\xampp2\htdocs\fyp\sendingemail.php on line 51
Quote
Fatal error: Call to a member function send() on a non-object in C:\xampp2\htdocs\fyp\sendingemail.php on line 52
I have aslo had trouble with the following attmepts:
$smtp = Mail::factory('smtp',array ('host' => $host,'port' =>$port,'auth' =>true,'username' =>$username,'password' =>$password));
Mail::factory('smtp',array ($host,$port,$username,$password));
If anyone has any help Thanks!
if (isset($_REQUEST['to']))
//if "email" is filled out, send email
{
//send email
echo "hi";
$from = $_REQUEST['from'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
$to = $_REQUEST['to'];
$host = "ssl://smtp.gmail.com";
$port = "465";
$username = "<xxxx.com>";
$password = "xxxx";
$headers = array ('From' => $from,'Subject' => $subject);
$smtp = Mail('smtp',array ($host,$port,$username,$password));
$mail = $smtp->send($to, $headers, $message);
if (PEAR::isError($mail))
{
echo("<p>" . $mail->getMessage() . "</p>");
}
else
{
echo("<p>Message successfully sent!</p>");
{
}
else
//if "email" is not filled out, display the form
//this is where the data and details are taken from
{
echo "<form method='post' action='sendingemail.php'>
To: <input name='to' type='text' />
<br />
From: <input name='from' type='text' />
<br />
Subject: <input name='subject' type='text' />
<br />
Message:
<br />
<textarea name='message' rows='15' cols='40'>
</textarea>
<br />
<input type='submit'value='Send Email'/>
</form>";
}
This post has been edited by Dormilich: 03 March 2011 - 07:29 AM
Reason for edit:: please use [code] /* your code source here */ [/code] tags when posting code

New Topic/Question
Reply




MultiQuote



|