I've got an SMTP server on my computer and running a website on a host, I want my mailer to connect to my smtp server to send the mail, this is what I've done so far:-
I get the error:-PHP Code:<?php
$server = "my ip";
$port = "25";
$to=$_POST['to'];
$subject=$_POST['subject'];
$from=$_POST['from'];
$body=$_POST['body'];
$headers = "From: $from";
$smtpconnect = fsockopen($server, $port);
if(mail($smtpconnect,$to,$subject,$body,$headers)) {
echo "Sent! <br><Br>Sent to: <br><Br><B>$to</B><br>Sent from: <B>$from</b><br>Message: <b>$body</b><br>";
} else {
echo "Failed! <br><br><B>$to</B><br>Sent from: <B>$from</b><br>Message: <b>$body</b><br>";
}
?>
Warning: mail() expects parameter 1 to be string, resource given in mail.php on line 11




Reply With Quote