KornShell (ksh) code pour envoyer des pièces jointes avec mailx et uuencode?

J'ai besoin de joindre un fichier avec mailx mais pour le moment je ne suis pas en avoir du succès.

Voici mon code:

subject="Something happened"
to="[email protected]"
body="Attachment Test"
attachment=/path/to/somefile.csv

uuencode $attachment | mailx -s "$subject" "$to" << EOF

The message is ready to be sent with the following file or link attachments:

somefile.csv

Note: To protect against computer viruses, e-mail programs may prevent
sending or receiving certain types of file attachments.  Check your
e-mail security settings to determine how attachments are handled.

EOF

Tous les commentaires seraient très appréciées.


Mise à jour
J'ai ajouté l'attachement var pour éviter d'avoir à utiliser le chemin d'accès à chaque fois.

OriginalL'auteur Nano Taboada | 2008-09-18