OVH Cloud OVH Cloud

[HS] fichiers attachés avec la cmd mail

5 réponses
Avatar
Fabrice Régnier
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 ;)

Merci et a+

f.


--
Pensez à lire la FAQ de la liste avant de poser une question :
http://wiki.debian.net/?DebianFrench

Pensez à rajouter le mot ``spam'' dans vos champs "From" et "Reply-To:"

To UNSUBSCRIBE, email to debian-user-french-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

5 réponses

Avatar
Sylvain Sauvage
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 <<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
Avatar
Laurent CARON
Sylvain Sauvage wrote:

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 <<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.






uuencode fichier fichier | mail -s "sujet"


--
Pensez à lire la FAQ de la liste avant de poser une question :
http://wiki.debian.net/?DebianFrench

Pensez à rajouter le mot ``spam'' dans vos champs "From" et "Reply-To:"

To UNSUBSCRIBE, email to
with a subject of "unsubscribe". Trouble? Contact
Avatar
Fabrice Régnier
merci beaucoup, ça marche au poil ;)

a+

F.


Sylvain Sauvage a écrit :
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 <<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.





--
Pensez à lire la FAQ de la liste avant de poser une question :
http://wiki.debian.net/?DebianFrench

Pensez à rajouter le mot ``spam'' dans vos champs "From" et "Reply-To:"

To UNSUBSCRIBE, email to
with a subject of "unsubscribe". Trouble? Contact
Avatar
Jean-Michel OLTRA
bonjour,


Le mercredi 27 octobre 2004, Fabrice Régnier a écrit...


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.



Je crois qu'on ne peut pas. Utilise Mutt pour ça ! Ou fais un cat du
texte pour le mettre dans le corps.

--
jm


--
Pensez à lire la FAQ de la liste avant de poser une question :
http://wiki.debian.net/?DebianFrench

Pensez à rajouter le mot ``spam'' dans vos champs "From" et "Reply-To:"

To UNSUBSCRIBE, email to
with a subject of "unsubscribe". Trouble? Contact
Avatar
Thomas Nemeth
Le 27.10.04, Jean-Michel OLTRA a tapoté :

| bonjour,

'lo.


| Le mercredi 27 octobre 2004, Fabrice Régnier a écrit...
| > 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.
|
| Je crois qu'on ne peut pas. Utilise Mutt pour ça ! Ou fais un cat du
| texte pour le mettre dans le corps.

Si si on peut.

001. cat fichier | mail root -s "sujet complet"
010. uuencode fichier-binaire | mail root -s "sujet complet"
011. mpack -s "sujet complet" fichier-binaire root
100. script perso utilisant mime


Thomas


--
Pensez à lire la FAQ de la liste avant de poser une question :
http://wiki.debian.net/?DebianFrench

Pensez à rajouter le mot ``spam'' dans vos champs "From" et "Reply-To:"

To UNSUBSCRIBE, email to
with a subject of "unsubscribe". Trouble? Contact