Page 1 of 1
Attachments and Outlook and Outlook Express
Posted: Tue Nov 07, 2006 2:37 pm
by Martinez
First of all thanks for the great library...
I am having a weird problem. I am sending emails with attachments.
(I used your example code as a base).
The attachments are not recognized by outlook or outlook express.
I bcc to myself (Mac Mail client) and I see the attachment fine.
Any thoughts on this...?
I let swift set the mime type (octet-stream) :
Code: Select all
$mailer = new Swift(new Swift_Connection_SMTP('mail.xxx.org'));
if ($mailer->isConnected()) {
$mailer->addAttachment(file_get_contents($file), $this->current_doc);
if ($this->test_email != '')
{
$mailer->send(
'<' . $this->test_email . '>',
'"' . $this->name . ' Ski Report" <dds@xxx.org>',
'Ski Report'
);
$mailer->close();
}
Again I see the attachments via Mac Mail client and online IMAP clients..
Thanks again
(And sorry about posting in the wrong area...)
More information...
Posted: Tue Nov 07, 2006 2:59 pm
by Martinez
Some more information I have gleamed from testing....
- 1. It happens for various document types.... pdf / word / xls
2. Outlook or Outlook express seems to recognize the attachement to download it. (...progress bar shows activity..)
3. When email finally displays, I recieve a blank body...
Posted: Tue Nov 07, 2006 3:51 pm
by Chris Corbyn
Do you have gpc_magic_quotes turned on perhaps?
Try:
Code: Select all
stripslashes(file_get_contents($file))
Also, what does the current_doc property actually look like? If you send me a copy of such an email (
chris@w3style.co.uk ) or copy the email source code upon receipt here I'll have a closer look.
The correct mime type of MS Word is "application/msword" if you want to set it directly

Aha... Found the solution
Posted: Tue Nov 07, 2006 4:06 pm
by Martinez
Solution is I neglected to add a body element..
Once I added:
$mailer->addPart('xxx attached....');
It worked like a charm...
Code: Select all
$mailer = new Swift(new Swift_Connection_SMTP('mail.xxx.org'));
if ($mailer->isConnected()) {
$mailer->addAttachment(file_get_contents($file), $this->current_doc);
$mailer->addPart('Ski Report attached');
if ($this->test_email != '')
{
$mailer->send(
'<' . $this->test_email . '>',
'"' . $this->name . ' Ski Report" <dds@xxx.org>',
'Ski Report'
);
$mailer->close();
}
}
........
Thanks again...
And I will be contributing to your mac mini fund....
Posted: Wed Nov 08, 2006 12:53 am
by Chris Corbyn
I'm surprised it didn't work without the body. Structurally the email would be fine without the body since the boundaries are all there and in the correct places. Glad you got it working anyway.
Thank you so much for the donation. Received this morning. Extremely generous and much appreciated

cut off filenames on outlook
Posted: Thu Sep 20, 2007 6:20 am
by jacknirons
Hi there

so, i have another outlook problem and no solution. the situation is, i have long filenames in my attached files. they will recognized by thunderbird very well. but on outlook and outlook express there seems to be a problem. because, they always add a txt-extension to the attached files.
I was looking around sometime and found a "old" thunderbird bugreport, but with the same problem (
http://kb.mozillazine.org/Attachments_renamed). The solution was, that the specific thunderbrid client supports a older standard for file attachments (RFC2047), the working a actuall (RFC2231).
So, i was tracking the swift code a little bit and seen that the libs are using a newer standard.
So, what was my question. ah, right. has anyone a working solution for cutoff filenames (after ~60 chars) on outlook ?

Re: cut off filenames on outlook
Posted: Thu Sep 20, 2007 6:28 am
by Chris Corbyn
jacknirons wrote:Hi there

so, i have another outlook problem and no solution. the situation is, i have long filenames in my attached files. they will recognized by thunderbird very well. but on outlook and outlook express there seems to be a problem. because, they always add a txt-extension to the attached files.
I was looking around sometime and found a "old" thunderbird bugreport, but with the same problem (
http://kb.mozillazine.org/Attachments_renamed). The solution was, that the specific thunderbrid client supports a older standard for file attachments (RFC2047), the working a actuall (RFC2231).
So, i was tracking the swift code a little bit and seen that the libs are using a newer standard.
So, what was my question. ah, right. has anyone a working solution for cutoff filenames (after ~60 chars) on outlook ?

Swift follows RFC2047 for long filenames. What version of Swift are you using? Do you have an example filename you are able to send me?
EDIT | Oops, sorry I do follow RFC2231. The encoding method comes is based on RFC2047. Been so long since I touched that code

Posted: Thu Sep 20, 2007 6:36 am
by jacknirons
Hey,
i'm sorry, but the name of the files are a strict internal thing. but you can take just every filename with 60 or more characters (with and without characters like whitespaces, [], () or points.
(i'm using outlook 2007 and a older outlook express version by a customer)
to this moment, we where using the 3.2.1 (php5) version of swift . in the last couple of minutes, i was updating to 3.3.1 (php5). same result :/
Posted: Thu Sep 20, 2007 6:38 am
by Chris Corbyn
jacknirons wrote:Hey,
i'm sorry, but the name of the files are a strict internal thing. but you can take just every filename with 60 or more characters (with and without characters like whitespaces, [], () or points.
(i'm using outlook 2007 and a older outlook express version by a customer)
to this moment, we where using the 3.2.1 (php5) version of swift . in the last couple of minutes, i was updating to 3.3.1 (php5). same result :/
If you were to send the same filename through Thunderbird does the filename arrive in-tact? I suspect MS is choking on the RFC2231 syntax for:
filename*0*="......"
filename*1*="...." etc etc etc
Posted: Thu Sep 20, 2007 6:47 am
by jacknirons
right right. i was sending examples (with the same file) through different other clients. thunderbird 2.0.0.6, gmail and a horde-clientinterface.
they arive all in tact, with headers like:
name="some_realy_large_filename_that_will_arrive_in_full_length_at_the_client.csv"
filename="some_realy_large_filename_that_will_arrive_in_full_length_at_the_client.csv"
emails, created and delivered with swift, as you surely know, contains:
name*0="some_realy_large_filename_that_will_arrive_";
name*1="in_full_length_at_the_client.csv"
filename*0="some_realy_large_filename_that_will_arrive_";
filename*1="in_full_length_at_the_client.csv"
Posted: Thu Sep 20, 2007 8:22 am
by jacknirons
so, eh, is there possible a chance to easily switch between this standards!?

Posted: Thu Sep 20, 2007 9:44 am
by jacknirons
eh, guys is it possible that you have replace the rfc204x support with a newer one?
because, i find comments and function that refeence to 204x or (fe: Swift_Message_Encoder::rfc2047Encode())
could you please deliver that older (possible removed) codepart, before i have to rewrite this part for myself?

Posted: Thu Sep 20, 2007 10:56 am
by RobertGonzalez
Please do not bump threads. Your question will be answered when someone has an answer. Our forum rules clearly state to not bump a thread for 24 hours after posting. Thank you.
Posted: Tue Nov 13, 2007 10:52 am
by afwt
Did anyone else had this same problem? No matter what client I try to send an email to, I get attachment names scrambled. And whatever mailer I use, no one is rewriting the header in the same way as SM....
