Notwithstanding my backup option of using links instead of
attachments, I discovered a way to make email attachments work for
both PC users as well as Mac users:
Line 294 of gluon.tools.py:
payload_in = MIMEMultipart.MIMEMultipart('related')
changed to:
payload_in = MIMEMultipart.MIMEMultipart('mixed')
Not sure this is a 'bug' as such, but perhaps the wrong Content-Type
for what I want. Maybe Macs are more strict about protocol than PCs.
I used the following to come to this conclusion.
http://en.wikipedia.org/wiki/MIME#Multipart_subtypes
Content-Type 'multipart/related' consists of a root part which
references other parts inline.
Content-Type 'multipart/mixed' is used for sending files with
different "Content-Type" headers inline or as attachments.
Whatever, it works for all my users now.
Bob
On Jun 9, 10:46 am, Bob_in_Comox <[email protected]> wrote:
> I send email out to 150 club members. No problems with simple emails.
> However with attachments only PC users can see and download them,
> while Mac uses cannot even see the attachments.
>
> using web2py 1.79.1 on webfaction with webfaction email servers
>
> My code (simplified):
>
> from gluon.tools import Mail
> attachments = [Mail.Attachment(path-to-file1, filename=filename1)]
>
> mail = Mail( 'smtp.webfaction.com:587', club-email-address, club-email-
> login)
> mail.send(
> to = [club-member-addresses],
> subject = subject,
> message = plain-text-message,
> attachments = attachments,
> reply_to = my-email-address)
>
> I do not change any default mail.settings.
>
> If I cannot fix this, my backup option will be to store attachments on
> our server, and use links to these in the message instead of
> attachments.
>
> Thanks for any suggestions.
>
> Bob