Mail is sent only once. Need to close connection?

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
User avatar
markis1986
Forum Newbie
Posts: 9
Joined: Fri Oct 19, 2007 12:58 am

Mail is sent only once. Need to close connection?

Post by markis1986 »

Hi i have this, "basic send mail".

When i execute it on my explorer's page - Mail is sent. But when i reexecute it - nothing happens :(
Do i need to close connection? Or is it closed automatically?

Code: Select all

<?php
 
//Load in the files we'll need
require_once "lib/Swift.php";
require_once "lib/Swift/Connection/SMTP.php";
 
//Start Swift
$swiftas =& new Swift(new Swift_Connection_SMTP("smtp_servers_name"));
 
//Create the message
$message =& new Swift_Message("My subject", "Ledo body");
 
//Now check if Swift actually sends it
if ($swiftas->send($message, "Sent-to-mail", "sent-from-mail")) echo "Sent";
else echo "Failed";
 ?>
Post Reply