[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [HS] fichiers attachés avec la cmd mail



Wed, 27 Oct 2004 08:39:00 +0200, Fabrice Régnier a écrit :
> Bonjour la liste,
> 
> J'essaie en vain d'envoyer un mail à root (avec la commande mail) qui 
> contient un fichier texte attaché. Je l'ai fait en php et je voudrais le
> refaire en shell.
> 
> Un lien, un site seront les bienvenus ;)

/usr/sbin/sendmail toto@shellroxes.org <<EOF
Subject: fichier attaché
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary= "CEQUEJEVEUX"

--CEQUEJEVEUX
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

blabla
--CEQUEJEVEUX
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename= "fichier.txt"

mon fichier txt...
--CEQUEJEVEUX--

.
<<EOF

Pour du binaire, il faut encoder (base64, uuencode...) (ne pas oublier de
modifier le champ Content-Transfer-Encoding.

-- 
Sylvain Sauvage



Reply to: