Sponsored Content
Operating Systems OS X (Apple) Problem with mail attachment in Snow Leopard Post 302400196 by RTM on Tuesday 2nd of March 2010 12:56:44 PM
Old 03-02-2010
This may help (or not)

Mail.app not recognizing Unix attachments

From that page:
Quote:
If under Leopard and before, you received email messages containing attachments the old Unix way:


begin 644 filename.ext
...uuencode stream here...
end

you may be surprized to see that Snow Leopard doesn't allow to use quick view anymore even if the attachement is of well known file extension (.html as an exemple…)

The attachment is now displayed as a "Mail Attachment" and visible only in any text editor… with TextEdit proposed as the default one.
Quite annoying if you have Unix jobs sending you automatic reports with bash lines like this:


uuencode filename.ext filename.ext | mail -s "My beautiful report" reader@mycompany.com

This doesn't work as before if "reader" is now using Snow Leopard… You have to do something like this:


#!/bin/sh

function usage
{
echo "Usage: $0 [-h] | [-t mimetype] [-e encoding] pathtoreport from to cc [cc ...]" 1>&2
}

set -- `getopt ht:e: "$@"` || {
exit 1
}

# our defaults: set yours…
mimetype="text/html"
encoding="ISO-8859-1"

while :
do
case "$1"
in
-t)
mimetype=$2; shift 2;;
-e)
encoding=$2; shift 2;;
-h)
help=$1; shift;;
--)
shift; break;;
esac
done

if test "$help" = "-h"
then
usage
exit 0
fi

if [ $# -lt 4 ]
then
usage
exit 1
fi

pathtoreport=$1
from=$2
to=$3
cc=$4

shift 4
ccs=$@

for cc1 in "$ccs"
do
cc="$cc, $cc1"
done

subject=`basename $pathtoreport`
b=`date +%Y%m%d%H%M%s`
boundary="--MYBOUNDARY_ID-"$b
(
cat <<EOF
MIME-Version: 1.0
To: $to
Cc: $cc
Content-type: multipart/alternative; boundary=$boundary
From: $from
Subject: $subject
Reply-To: $from

$boundary
Content-Transfer-Encoding: quoted-printable
Content-Type: $mimetype;
charset=$encoding

$(cat "$pathtoreport")

$boundary
EOF
) | /usr/sbin/sendmail -t

And call it that way:


sendreport.sh PATH_TO/filename.ext sender@thisserver.com reader@mycompany.com other@mycompany.com

Feel free to adapt to your taste and context of usage... And of course, if you know of another solution invoking only some settings to change at client side under Snow Leopard: let us know !

Last edited by RTM; 03-02-2010 at 03:46 PM.. Reason: adding info from web site in case it disappears in the future
 

4 More Discussions You Might Find Interesting

1. OS X (Apple)

MacPorts on Snow Leopard

Hello everyone. I was previously using MacPorts 1.8 on Mac OS 10.5.8 without any problems and everything was working well. I recently upgraded to Xcode 3.2 and Mac OS 10.6, since then my MacPorts installation has not been working at all. I deleted it and then reinstalled the .dmg from the... (1 Reply)
Discussion started by: HoldenCaulfield
1 Replies

2. OS X (Apple)

Alpine 2 on Snow Leopard

I've just installed Alpine on Snow Leopard but can't seem to get a default spell checker configured for it. What happened to spell? I can't find it at all on 10.6, must have been some changes. Does anyone know about the default unix spell checker on SL? Thanks! (0 Replies)
Discussion started by: platz
0 Replies

3. OS X (Apple)

Installing Oracle 10g on Snow Leopard using this tutorial

This tutorial. Which is a lovely tutorial, really, and was working up until this instruction: Now download db.zip installation archive and place it somewhere and unzip it: mkdir Install cd Install # download db.zip to this directory unzip db.zip cd db/Disk1 I didn't know how to... (1 Reply)
Discussion started by: khayraB
1 Replies

4. OS X (Apple)

fetchmail and postfix mail setup on Snow Leopard - request for guidance

Howdy, I hope it is ok to post this here. I would like to do all my POP3 email with fetchmail, postfix and emacs. On Snow Leopard 10.6.8 - this is not urgent and I really want to do it in one of the right ways. This is fetchmail release 6.3.11+GSS+SSL+KRB5. postconf mail_version = 2.5.14 GNU... (11 Replies)
Discussion started by: butterbaerchen
11 Replies
Catalyst::View::Email::Template(3pm)			User Contributed Perl Documentation		      Catalyst::View::Email::Template(3pm)

NAME
Catalyst::View::Email::Template - Send Templated Email from Catalyst SYNOPSIS
Sends templated mail, based upon your default view. It captures the output of the rendering path, slurps in based on mime-types and assembles a multi-part email using Email::MIME::Creator and sends it out. CONFIGURATION
WARNING: since version 0.10 the configuration options slightly changed! Use the helper to create your view: $ script/myapp_create.pl view Email::Template Email::Template For basic configuration look at "CONFIGURATION" in Catalyst::View::Email. In your app configuration (example in YAML): View::Email::Template: # Optional prefix to look somewhere under the existing configured # template paths. # Default: none template_prefix: email # Define the defaults for the mail default: # Defines the default view used to render the templates. # If none is specified neither here nor in the stash # Catalysts default view is used. # Warning: if you don't tell Catalyst explicit which of your views should # be its default one, C::V::Email::Template may choose the wrong one! view: TT SENDING EMAIL
Sending email works just like for Catalyst::View::Email but by specifying the template instead of the body and forwarding to your Email::Template view: sub controller : Private { my ( $self, $c ) = @_; $c->stash->{email} = { to => 'jshirley@gmail.com', cc => 'abraxxa@cpan.org', bcc => 'hidden@secret.com hidden2@foobar.com', from => 'no-reply@foobar.com', subject => 'I am a Catalyst generated email', template => 'test.tt', content_type => 'multipart/alternative' }; $c->forward( $c->view('Email::Template') ); } Alternatively if you want more control over your templates you can use the following idiom to override the defaults. If charset and encoding given, the body become properly encoded. templates => [ { template => 'email/test.html.tt', content_type => 'text/html', charset => 'utf-8', encoding => 'quoted-printable', view => 'TT', }, { template => 'email/test.plain.mason', content_type => 'text/plain', charset => 'utf-8', encoding => 'quoted-printable', view => 'Mason', } ] HANDLING ERRORS
See "HANDLING ERRORS" in Catalyst::View::Email. METHODS
generate_part Generates a MIME part to include in the email. Since the email is template based every template piece is a separate part that is included in the email. process The process method is called when the view is dispatched to. This creates the multipart message and then sends the message contents off to Catalyst::View::Email for processing, which in turn hands off to Email::Sender::Simple. TODO
ATTACHMENTS There needs to be a method to support attachments. What I am thinking is something along these lines: attachments => [ # Set the body to a file handle object, specify content_type and # the file name. (name is what it is sent at, not the file) { body => $fh, name => "foo.pdf", content_type => "application/pdf" }, # Or, specify a filename that is added, and hey, encoding! { filename => "foo.gif", name => "foo.gif", content_type => "application/pdf", encoding => "quoted-printable" }, # Or, just a path to a file, and do some guesswork for the content type "/path/to/somefile.pdf", ] SEE ALSO
Catalyst::View::Email - Send plain boring emails with Catalyst Catalyst::Manual - The Catalyst Manual Catalyst::Manual::Cookbook - The Catalyst Cookbook AUTHORS
J. Shirley <jshirley@gmail.com> Simon Elliott <cpan@browsing.co.uk> Alexander Hartmaier <abraxxa@cpan.org> LICENSE
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2011-01-17 Catalyst::View::Email::Template(3pm)
All times are GMT -4. The time now is 12:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy