Page 1 of 1

Problem sending two mails with attachments

Posted: Mon Apr 07, 2008 4:26 am
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

Re: Problem sending two mails with attachments

Posted: Mon Apr 07, 2008 6:00 am
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?

Re: Problem sending two mails with attachments

Posted: Mon Apr 07, 2008 6:05 am
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 :?

Re: Problem sending two mails with attachments

Posted: Mon Apr 07, 2008 6:20 am
by Chris Corbyn
What's the server's memory limit? And how much memory is being used at the time?

Re: Problem sending two mails with attachments

Posted: Mon Apr 07, 2008 6:21 am
by Chris Corbyn
See:

Code: Select all

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

http://au2.php.net/manual/en/function.m ... -usage.php

Re: Problem sending two mails with attachments

Posted: Mon Apr 07, 2008 6:30 am
by Ygor
That function returns nothing to me, but in php.ini I got 128M

Re: Problem sending two mails with attachments

Posted: Mon Apr 07, 2008 7:34 am
by Chris Corbyn
What does:

Code: Select all

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