Attachment not being sent
Posted: Thu Jul 26, 2007 5:17 pm
PHP 4.3.11
Swift 3.2.6
It keeps on sending me a file called "file.att.0" instead of the actual file. I tried putting in the file extension, didn't work either. The MIME type is application/x-gzip, I've checked in Nautilus. The file in question is ~7 MB.
I tried with a smaller text file, but that worked.
Thanks.
Swift 3.2.6
Code: Select all
<?php
set_time_limit(0);
error_reporting(E_ALL);
//Load in the files we'll need
require_once "lib/Swift.php";
require_once "lib/Swift/Connection/SMTP.php";
//Start Swift
$smtp =& new Swift_Connection_SMTP("smtp.gmail.com", SWIFT_SMTP_PORT_SECURE, SWIFT_SMTP_ENC_TLS);
$smtp->setUsername("test@gmail.com");
$smtp->setPassword("aaaaaaaaaaaaaaaaaaaaaaa");
$swift =& new Swift($smtp);;
$message =& new Swift_Message("My subject");
$message->attach(new Swift_Message_Part("I have attached a file to this message!"));
//Use the Swift_File class
$message->attach(new Swift_Message_Attachment("aaaaaaa"), "aaaaaa", "application/x-gzip");
//Now check if Swift actually sends it
if ($swift->send($message, "test@test.com", "test@gmail.com")) echo "Sent";
else echo "Failed";
?>I tried with a smaller text file, but that worked.
Thanks.