Debian: use Exim to relay mails with Yahoo’s smarthost

When you install Debian, you may want to use some tools or softwares that send emails hrough a Mail Transfer Agent (MTA) like Exim, and you probably want these emails right in your mailbox. For example, I think of 2 tools which could use such a MTA:

  • apticron, a script that informs you about the updates available for your OS,
  • mutt, a text-based mail client.

I have an Yahoo email account for more than 15 years now and, as a heavy user of their services, I was curious about the SMTP relay that Yahoo offer to people who already have an account.

Well, as Exim is installled by default on a fresh new system, the only steps to make it work are these:

  • Configure Exim to use what is called a smarthost (the SMTP relay at Yahoo!). There’s a wizard that you can follow to complete this first step
  • Configure your Yahoo! account so that Exim can share it with Yahoo! in order to allow you to use the relay.
  • Configure your sender address: Yahoo! controls this address too.

1/ Configure Exim

First connect as root. The configuration wizard is launched by entering:

# dpkg-reconfigure exim4-config

Question 1: choose “mail sent by smarthost; no local mail”

Question2: For the mail name, I chose ctrlaltsuppr.net. This choice does not matter at this stage as we will configure the email of the sender in the file /etc/email-addresses later.

Question 3: You can keep here the default IP addresses (127.0.0.1; ::1) as the goal here is to send and not receive mails. Note that ::1 is the IPv6 address for localhost (as 127.0.0.1 for IPv4). You can check at the end of the wizard the ports Exim is listening by entering the command

# exiwhat

937 daemon: -q30m, listening for SMTP on [127.0.0.1]:25 [::1]:25

You can see that Exim is able to process local mails on the standard SMTP port.

Question 4: leave the field empty or erase the default: we do not want to accept mails from a domain outside.

Question 5: There’s a link between question 2 and this one but i did not get it completely. Again, I chose ctrlaltsuppr.net but it does not seem to important as we will configure the email of the sender in the file /etc/email-addresses later.

Question 6: Here you write the name of the smarthost which is, for Yahoo!:

smtp.mail.yahoo.com::587

Don’t forget to double the semi-colons ! See man update-exim4-conf.

You can normally choose between the ports 465 and 587. 587 implies to use STARTTLS to encrypt the communications with the smarhost and require to provide an username and a password. 587 works a treat !

Question 7: I chose not to minimze the DNZ requests.

Question 8: I chose <No> to use the non-split configuration.

2/ Configure your Yahoo! account

# nano /etc/exim4/passwd.client

See man exim4_passwd_client for more informations.

This file is used for SMTP authentication when Exim works as a client: it is the case here. The values (one by line) are those that Exim can read from reverse DNS: it first gets the IP address of the smarthost (here smtp.mail.yahoo.com) and then gets the name linked to this IP by making a reverse DNS request. The result of this last request must be in the passwd.client file.

# host smtp.mail.yahoo.com

smtp.mail.global.gm0.yahoodns.net has address 217.146.190.250

# host 217.146.190.250

250.190.146.217.in-addr.arpa domain name pointer vcs-s-m-yc.mail.vip.ir2.yahoo.com.

So, you can enter:

*.yahoo.com:<my_yahoo_username>:<my_yahoo_password>

in the passw.client file.

3/ Configure the sender address

On my system, I have two users: me as a standard user and root. You got to link these users with proper mail adresses that Yahoo! is able to accept.

To increase the security of these accounts, you can configure extra email addresses that you can trash later. These addresses are not those used to identify by Yahoo!.

# nano /etc/email-addresses

<standard_user>:<mail1@yahoo.com>

root:<mail2@yahoo.com

 

Hope it helps !

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *