Je voudrais faire un cadre approximatif pour un script BASH qui m'envoie un e-mail à mon compte GMail du même compte si un programme se termine avec un résultat différent deEnvoyer un mail via la ligne de commande et GMail
test "script to execute"
then
//Send me a mail with the content of /worked.txt
else
//Send me a mail with the content of /failed.txt
fi
Je l'ai lu est comme ça
mail [email protected] < /worked.txt
il ne ... rien Non E-mail, aucune erreur, rien ne
-v dit maintenant:
> [email protected] Connecting to [127.0.0.1] via relay... 220
> my-laptop.lan ESMTP Sendmail
> 8.14.3/8.14.3/Debian-9.1ubuntu1; Wed, 10 Nov 2010 18:34:49 +0100; (No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1]
> >>> EHLO my-laptop.lan 250-my-laptop.lan Hello localhost [127.0.0.1], pleased to meet you 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-EXPN
> 250-VERB 250-8BITMIME 250-SIZE 250-DSN 250-ETRN 250-AUTH DIGEST-MD5
> CRAM-MD5 250-DELIVERBY 250 HELP
> >>> VERB 250 2.0.0 Verbose mode
> >>> MAIL From:<[email protected]> SIZE=220 [email protected] 250 2.1.0 <[email protected]>... Sender
> ok
> >>> RCPT To:<[email protected]>
> >>> DATA 250 2.1.5 <[email protected]>... Recipient ok 354 Enter mail, end with "." on a line by itself
> >>> . 050 <[email protected]>... Connecting to gmail-smtp-in.l.google.com. via esmtp... 050 220 mx.google.com ESMTP
> c6si1047453fat.137 050 >>> EHLO my-laptop.lan 050 250-mx.google.com at
> your service, [188.19.112.229] 050 250-SIZE 35651584 050 250-8BITMIME
> 050 250 ENHANCEDSTATUSCODES 050 >>> MAIL From:<[email protected]>
> SIZE=481 050 250 2.1.0 OK c6si1047453fat.137 050 >>> RCPT
> To:<[email protected]> 050 250
> 2.1.5 OK c6si1047453fat.137 050 >>> DATA 050 354 Go ahead c6si1047453fat.137 050 >>> . 050 250
> 2.0.0 OK 1289410490 c6si1047453fat.137 050 <[email protected]>... Sent (OK 1289410490 c6si1047453fat.137) 250 2.0.0 oAAHYn4X005767 Message
> accepted for delivery [email protected] Sent (oAAHYn4X005767 Message
> accepted for delivery) Closing connection to [127.0.0.1]
> >>> QUIT 221 2.0.0 my-laptop.lan closing connection
Cela devrait fonctionner correctement, essayez d'ajouter l'option -v pour voir ce qu'il fait. –