Problem sending two mails with attachments

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
Ygor
Forum Newbie
Posts: 3
Joined: Mon Apr 07, 2008 4:11 am

Problem sending two mails with attachments

Post by Ygor »

Hi,

As the title says, I am trying to send two mail messages with attachments, but only the first one gets to its destination.

Also, I am getting no errors for it, just an annoying blank page.

Here is my code:

Code: Select all

$connectionobject = new Swift_Connection_SMTP(xxxxx);
$connectionobject->setUsername(xxxxx);
$connectionobject->setPassword(xxxxx);
                            
$connectionobject->attachAuthenticator(new Swift_Authenticator_LOGIN());
$swift = new Swift($connectionobject);
                            
                        
$message = new Swift_Message($subject);
$message->setReturnPath(xxxxx);
                            
$message->attach(new Swift_Message_Part($body,"text/html"));
$message->attach(new Swift_Message_Attachment(new Swift_File($_FILES['factura']['tmp_name']), $_FILES['factura']['name']));
    
$swift->send($message, $client_email,$our_mail);                        
$swift->disconnect();
                        
$connectionobject2 = new Swift_Connection_SMTP(xxxxx);
$connectionobject2->setUsername(xxxxx);
$connectionobject2->setPassword(xxxxx);
                            
$connectionobject2->attachAuthenticator(new Swift_Authenticator_LOGIN());
$swift2 = new Swift($connectionobject2);
                                        
$message2 = new Swift_Message($subject2);
$message2->setReturnPath(xxxxx);
                            
$message2->attach(new Swift_Message_Part($body2,"text/html"));
$message2->attach(new Swift_Message_Attachment(new Swift_File($_FILES['factura3']['tmp_name']), $_FILES['factura3']['name']));
 
$swift2->send($message2,$ygor_mail,$our_mail);
                        
$swift2->disconnect();
It looks kind of lame that I'm using two swift objects to send the messages, but that was just my first approach to get rid of this problem (which obviously didn't work).

Thanks,
Ygor
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Problem sending two mails with attachments

Post by Chris Corbyn »

Blank page suggests fatal error. Do you have error reporting on full and display errors on?

Code: Select all

<?php error_reporting(E_ALL); ini_set('display_errors', true); ?>
EDIT | Also, how big are the attachments?
Ygor
Forum Newbie
Posts: 3
Joined: Mon Apr 07, 2008 4:11 am

Re: Problem sending two mails with attachments

Post by Ygor »

I have error reporting on full, display errors on and had watched php and apache error logs, and nothing.

I had forgot to mention that the attachment size is 79 KB; if I try a smaller attachment like 20KB it works :?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Problem sending two mails with attachments

Post by Chris Corbyn »

What's the server's memory limit? And how much memory is being used at the time?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Problem sending two mails with attachments

Post by Chris Corbyn »

See:

Code: Select all

echo ini_get('memory_limit');
and...

http://au2.php.net/manual/en/function.m ... -usage.php
Ygor
Forum Newbie
Posts: 3
Joined: Mon Apr 07, 2008 4:11 am

Re: Problem sending two mails with attachments

Post by Ygor »

That function returns nothing to me, but in php.ini I got 128M
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Problem sending two mails with attachments

Post by Chris Corbyn »

What does:

Code: Select all

var_dump($_FILES);
Show? Any errors in the upload?
Post Reply