Outils pour utilisateurs

Outils du site


issue140:tutoriel2

Ceci est une ancienne révision du document !


Suppose your email demands are rather modest and you just need to send occasional emails from your PC, especially if you like to send information from a job which is supposed to be run regularly. This may be a problem if you don't have access to the company email server. Webmail systems (such as Gmail) can be utilised, but they are ill-suited for this purpose and installing a full-featured email system on a PC would be a major undertaking. If your ISP's email offering is sufficiently reliable despite the various restrictions they will impose, then the sendemail command will be of some interest. Use of sendemail doesn't prevent you using full-featured email clients such as Thunderbird or webmail systems.

Supposez que vos demandes pour les mails soient plutôt modestes et que vous avez juste besoin d'envoyer occasionnellement des mails à partir de votre PC, particulièrement si vous aimez envoyer des informations à partir d'un programme qui est supposé tourner régulièrement. Ce pourrait être un problème si vous n'avez pas accès au serveur de mail de l'entreprise. Les systèmes de Webmail (comme Gmail) peuvent être utilisés, mais il sont assez mal taillés pour ce besoin et l'installation d'un système de messagerie complet sur un PC serait une tâche de grande ampleur. Si les offres de messagerie de vous fournisseur internet (ISP) est suffisamment fiable en dépit des nombreuses restrictions qu'ils imposeront, alors la commande senmail présentera quelque intérêt. L'utilisation de sendmail ne vous empêche nullement d'utiliser un client de messagerie complet comme Thunderbird ou des systèmes de Webmail.

Sendemail makes use of a facility provided by most ISP's (but not all) who provide a simple direct route into their email servers. This will be via a so-called “smart host” (or email relay, mailhost or mailhub) - officially a MTA (Mail Transfer Agent) that simply passes any emails sent to it to your ISP's mail servers for onward delivery. In order that this route cannot easily be used to send spam, your ISP will impose some limitations. They will certainly not allow large numbers of emails to be sent and they may additionally require you to provide user/password details. But the principal check on your identity is that when you make your internet connection they allocate you an IP address from the pool of addresses owned by them, so your email can be identified as being sent by one of their customers. So it is definitely not a means of sending anonymous emails!

Sendmail fait usage d'un facilité fournie par la plupart des ISP (mais pas tous), un simple routage direct dans leurs serveurs de messagerie. Ceci sera via ce qu'on appelle un « smart host » (hôte intelligent) ou relais de messagerie, mailhost ou mailhub - officiellement un MTA (Mail Transfer Agent - Agent de transfert de messagerie) qui passe simplement tous les mails qui lui sont envoyés aux serveurs de mail de votre ISP pour une livraison ultérieure. De façon à ce que ce routage ne soit pas utilisé facilement pour l'envoi de pourriels, votre ISP vous imposera certaines limites. Il ne vous permettra certainement pas d'envoyer un grand nombre de messages et il vous imposera peut-être en plus de fournir le détail de vos nom/mot de passe. Mais la vérification principale de votre identité est que, lors de votre connexion à Internet, il vous fournit un dresse IP tirée d lot d'adresses qu'il possède ; ainsi, votre message peut être identifié comme étant envoyé par l'un de ses clients. Ce n'est donc vraiment pas le bon moyen d'envoyer des mails anonymes.

Your ISP should be able to give full details about using their smart host (or SMTP relay). But if not, whilst any list of ISPs and their smart hosts is almost certainly wrong or out of date, one site that may be worth trying is:- https://www.iw-webhosting.co.uk/smtp_hosts.htm Installation of the lightweight email sender (which needs no configuration) is straightforward:- sudo apt install sendemail This is designed to be used in shell scripts, or possibly from the command line. Because emails can take quite a variety of options, the parameters required can be rather lengthy.

Votre ISP devrait être capable de donner tous les détails pour utiliser leur hôte intelligent ( ou relais SMTP). Sinon, bien que toute liste des ISP et de leurs relais intelligents puisse être erronée ou perimée, le site suivant m&rite qu'on y jette un œil : https://www.iw-webhosting.co.uk/smtp_hosts.htm

Installation du transmetteur de mail léger (qui ne nécessite aucune configuration) est directe :

sudo apt install sendemail

Ceci est conçu pour être utilisé directement dans des scripts shell, ou probablement en ligne de commande. Comme les mails peuvent avoir un bon nombre d'options, les paramètres nécessaires peuvent être assez longs.

The only required parameters are the senders email address, a destination address and the name of the smart host. Because email servers usually check that the IP address of the sender matches that recorded in the DNS system and we aren't able to provide that kind of information we can invent a sender’s email address (as it can't be checked, it doesn't matter whether it is valid or not). This seems to work well, for example, Gmail doesn't mark these emails as Spam, although it does warn that it couldn't verify the sender’s identity. Note that should the receiver reply to the email, the sender’s email address will only be used if there is no “reply-to” address supplied. So if the email might be replied to, it is important to include a valid “reply-to” address.

Les seuls paramètres exigés sont l'adresse mail de l'envoyeur, une adresse de destination et le nom du « smart host ». Comme les serveurs de mail vérifient habituellement que l'adresse IP de l'envoyeur correspond à celle enregistrée dans le système DNS et que nous ne sommes pas capables de fournir ce genre d'information, nous pouvons inventer l'adresse mail de l'envoyeur

Incidentally, this is how a lot of spam is constructed; you are presented with a faked, but reasonable seeming sender’s address, but any reply is sent to the reply-to address which tells the spammer that your email address is active and used by a real person and therefore of value. As a rather trivial example we could enter into a command line:- sendemail -f xxxx@zzzz.com -o reply-to=myemail@mydomainname.com -t test@gmail.com -u 'test of sendemail' -s relay.plus.net I have used a genuine smart host (relay.plus.net) and have specified my invented from-address with the -f parameter, but note that the domain, zzzz.com almost certainly belongs to somebody.

The optional -o reply-to= specifies the real email address where I want any replies to go to – otherwise an attempt will be made to send replies to the zzzz.com mail server (if it exists). The -t parameter specifies a destination address (but don't use test@gmail.com – that must belong to someone); this should be a valid email address that you have access to. The -u parameter specifies the subject field, it is enclosed in quotes because of the presence of special characters (spaces). Finally, I've used the -s parameter to specify my ISP's smart host (relay.plus.net).

However, since I've omitted any reference to the email body, sendemail will attempt to take it from standard input. This can be very useful in a script, but if I enter the above example into the command line, I would be prompted for some body text:- Reading message body from STDIN because the '-m' option was not used. If you are manually typing in a message: - First line must be received within 60 seconds. - End manual input with a CTRL-D on its own line. This isn't usually very convenient so I can specify the message body in two ways, either directly with the -m parameter (example: -m “This is the message body”) or by giving the name of a text file that contains the message body (example: -o message-file=/var/log/user.log).

File attachments are included with the -a parameter, followed by a list of file names separated by spaces or other acceptable delimiters. In a similar way, sending to multiple email addresses is possible by specifying a list of addresses for the -t parameter. Lists of addresses can also be entered for the -cc and -bcc (copy & blind copy) parameters. It should be mentioned that the usual smart host port number is 25, which is the default. However, other values are possible so that the smart host might read relay.plus.net:587 (if port 587 is required). In addition you might need to use the -xu and -xp parameters (for user and password), but hopefully your ISP hasn't encountered sufficient abuse of the facility to make this necessary.

I have only scratched the surface of what this command can do. For a brief summary of what is possible, enter man sendemail For a fuller summary, enter sendemail –help For detailed help, enter one of sendemail –help addressing sendemail –help message sendemail –help misc sendemail –help networking sendemail –help output

issue140/tutoriel2.1546412050.txt.gz · Dernière modification : 2019/01/02 07:54 de d52fr