issue115:tuto1
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
issue115:tuto1 [2016/11/29 09:12] – créée d52fr | issue115:tuto1 [2016/12/12 16:03] (Version actuelle) – auntiee | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | Every now and again, I trip myself up when I’m trying to send outbound email from the command-line via a script or an application. A seemingly simple task such as changing the sender’s email address can sometimes take lots of time to get working. What follows will hopefully get you closer to a solution a little quicker. | + | **Every now and again, I trip myself up when I’m trying to send outbound email from the command-line via a script or an application. A seemingly simple task such as changing the sender’s email address can sometimes take lots of time to get working. What follows will hopefully get you closer to a solution a little quicker. |
Even if you have an MTA (Mail Transfer Agent) like the excellent Postfix (http:// | Even if you have an MTA (Mail Transfer Agent) like the excellent Postfix (http:// | ||
Ligne 11: | Ligne 11: | ||
mailx r ' | mailx r ' | ||
- | Let’s look a little closer. You can easily change the “r” option to configure which “from line” is presented to the mail client when the email is picked up at the other end. This is sometimes surprisingly difficult to get working with other command-line mail clients. | + | Let’s look a little closer. You can easily change the “r” option to configure which “from line” is presented to the mail client when the email is picked up at the other end. This is sometimes surprisingly difficult to get working with other command-line mail clients.** |
- | The other options hopefully make sense too. The “s” option allows you to edit your email’s subject whereas the “a” option is the filename of the attachment that you are adding from your local filesystem. One handy hint is to compress the file if the plain text arrives with extra, unwanted carriage returns. Incidentally you should also ensure that you’re using the full path to the attached file if you have issues. | + | De temps en temps, je me trompe quand j' |
+ | |||
+ | Même si vous avez installé un MTA (Mail Transfert agent - Agent de transfert du courrier) comme l' | ||
+ | |||
+ | Passons à l' | ||
+ | |||
+ | aptget install heirloommailx | ||
+ | |||
+ | Réfléchissons un instant à cet exemple bien rempli de ligne de commande : | ||
+ | |||
+ | mailx r ' | ||
+ | |||
+ | Regardons-le d'un peu plus près. Vous pouvez facilement changer l' | ||
+ | |||
+ | **The other options hopefully make sense too. The “s” option allows you to edit your email’s subject whereas the “a” option is the filename of the attachment that you are adding from your local filesystem. One handy hint is to compress the file if the plain text arrives with extra, unwanted carriage returns. Incidentally you should also ensure that you’re using the full path to the attached file if you have issues. | ||
Take careful note that the above command-line example isn’t strictly complete and can either be terminated successfully with “< / | Take careful note that the above command-line example isn’t strictly complete and can either be terminated successfully with “< / | ||
Ligne 21: | Ligne 35: | ||
mailx r ' | mailx r ' | ||
- | I’m pointing this out because you could also insert a text file into the body by replacing “< / | + | I’m pointing this out because you could also insert a text file into the body by replacing “< / |
- | Consider this scenario now for a second: you don’t want to insert a whole file but instead send some other text directly from your command-line. You can also follow this now familiar format by echoing text through a pipe: | + | De même, les autres options sont compréhensibles, |
+ | |||
+ | Prenez bonne note que l' | ||
+ | |||
+ | Comparez et différenciez l' | ||
+ | |||
+ | mailx r ' | ||
+ | |||
+ | Je vous précise ceci car vous pourriez aussi insérer un fichier texte dans le corps du message en remplaçant « /dev/null » par quelque chose comme cet exemple « / | ||
+ | |||
+ | **Consider this scenario now for a second: you don’t want to insert a whole file but instead send some other text directly from your command-line. You can also follow this now familiar format by echoing text through a pipe: | ||
echo e “Text content goes here.\n And here.” | mailx r ' | echo e “Text content goes here.\n And here.” | mailx r ' | ||
Ligne 31: | Ligne 55: | ||
Note that it’s easy to add multiple email addresses for the recipients (simply separating them by spaces). | Note that it’s easy to add multiple email addresses for the recipients (simply separating them by spaces). | ||
- | Before we stop looking at command-line email, let’s quickly think about an alternative to solving the problem of changing the “from line” or sender name. It’s not too tricky (I’m sure you’ll be glad to read). | + | Before we stop looking at command-line email, let’s quickly think about an alternative to solving the problem of changing the “from line” or sender name. It’s not too tricky (I’m sure you’ll be glad to read).** |
- | Another command-line email client option is to install “mutt” in case you can’t get your hands on a “mailx” derivative. In order to use it, you have to edit the “.muttrc” file, found in the home directory of the user who is sending the email. Here’s an example: | + | Maintenant, analysez ce scénario pendant une seconde : vous ne voulez pas insérer un fichier complet, mais, plutôt, envoyer un autre texte, directement depuis votre ligne de commande. Vous pouvez aussi faire suivre ce format, maintenant connu, par un écho du texte à travers un « pipe » : |
+ | |||
+ | echo e “Text content goes here.\n And here.” | mailx r ' | ||
+ | |||
+ | Je n'ai pas encore expliqué que l' | ||
+ | |||
+ | Notez qu'il est facile d' | ||
+ | |||
+ | Avant de terminer notre aperçu des mails en ligne de commande, réfléchissons rapidement à une alternative pour résoudre le problème de la modification de la ligne « De » ou du nom de l' | ||
+ | |||
+ | **Another command-line email client option is to install “mutt” in case you can’t get your hands on a “mailx” derivative. In order to use it, you have to edit the “.muttrc” file, found in the home directory of the user who is sending the email. Here’s an example: | ||
set realname=" | set realname=" | ||
Ligne 41: | Ligne 75: | ||
There’s lots more information on the superb Mutt (http:// | There’s lots more information on the superb Mutt (http:// | ||
- | Personally, I prefer the “mail" | + | Personally, I prefer the “mail" |
+ | |||
+ | Une autre option du client de mail en ligne de commande est d' | ||
+ | |||
+ | set realname=" | ||
+ | |||
+ | Dans le texte de « .muttrc » ci-dessus, l' | ||
+ | |||
+ | Il y a beaucoup plus d' | ||
+ | |||
+ | Personnellement, |
issue115/tuto1.1480407141.txt.gz · Dernière modification : 2016/11/29 09:12 de d52fr