The server i'm using runs Windows 2003 Server and a smtp server to send email.
Without Swift I have to do ini_set("sendmail_from", "xpto@mydomain.com") - a valid email account - in every script I send email.
Now I need to do a "tell-a-friend" script where the user submit a form with his name, email, a short message and his friend's name and email.
Code: Select all
ini_set("sendmail_from", "xpto@mydomain.com");
$headers = 'MIME-Version: 1.0\r\n';
$headers .= 'Content-type: text/html; charset=iso-8859-1; format=flowed\r\n';
$headers = 'From: ' . $YourName . '<' . $YourEmail . '>\r\n';
mail($FriendEmail, $subject, $emailMessage, $headers);
But this, with Swift mailer does not send the messages.
Code: Select all
require_once $swiftPath . "Swift.php";
require_once $swiftPath . "Swift/Connection/SMTP.php";
$swift = new Swift(new Swift_Connection_SMTP("localhost", 25));
$subject = $YourName . " sent you an invite";
$message = new Swift_Message($subject, $emailMessage, "text/html");
$swift->send($message, $FriendEmail, new Swift_Address($YourEmail, $YourName));
Is there a way/workaround to solve the problem?
Best regards
holo