How to send emails through an External SMTP Service on Digital Ocean? - email

I would like to send emails through an External SMTP Service (Yandex) with Sendmail on Ubuntu 18.04.3. I use Digital Ocean.
I set everything up: External SMTP Service, Sendmail, hostname. I added the MX record to my DNS.
~hostname
childrengo.org (my domain)
~host childrengo.org
childrengo.org has address <IP>
childrengo.org mail is handled by 10 mx.yandex.net.
I made a file with my login and password - /etc/mail/authinfo/yandex-auth :
AuthInfo:smtp.yandex.ru "U:<My login>" "I:<email>" "P:<password>" "M:<login>"
AuthInfo:smtp.yandex.ru:587 "U:<My login>" "I:<email>" "P:<password>" "M:<login>"
And than:
makemap hash /etc/mail/authinfo/yandex-auth < /etc/mail/authinfo/yandex-auth
I set up Sendmail to send emails through an External SMTP Service (Yandex).
But I have got an error in my syslog:
: STARTTLS=client, relay=smtp.yandex.ru., version=TLSv1.3, verify=FAIL, cipher=TLS_AES_256_GCM_SHA384, bits=256/256
: 05BInLgB007204: AUTH=client, available mechanisms do not fulfill requirements
: AUTH=client, relay=smtp.yandex.ru., temporary failure, connection abort
: 05BInLgB007204: to=<EMAIL>, ctladdr=<root#childrengo.org> (0/0), delay=00:11:24, xdelay=00:00:00, mailer=relay, pri=300379, relay=smtp.yandex.ru. [<IP>], dsn=4.0.0, stat=Deferred: Temporary AUTH failure
I checked this https://www.digitalocean.com/community/tutorials/how-to-send-email-through-an-external-smtp-service-with-sendmail-on-freebsd-10-1 and this https://www.digitalocean.com/community/questions/ubuntu-14-04-lamp-installed-sendmail-fatal-error-when-i-sent-first-message It did not help.
I installed cyrus-sasl*
I have the TXT records for DMARC1, spf1 and DKIM for my domain.
I have tried different users to send email. And I checked the password. I also checked the user exists.
I also don't see these errors in my mail.log and in mail.err
Do you have any idea how to fix it? Or may be how to debug it?

I installed SASL again:
sudo apt-get install sasl2-bin
service saslauthd restart
service sendmail restart
After that I had a problem with authorisation. It failed even if I was sure the login and password combination is right.
In the end I find out a tricky thing. There is an application password which you can user to let some application to login to your mail from the yandex mail provider. But if you create a mail for your domain on yandex it cannot login through smtp with a password nor with an application password. It does not know which combination is ok and just return an error.
So I removed an application password and everything works fine now. I hope this small trick also would useful for somebody.

may be you need to change droplet name to domain name.

Related

The IP you're using to send mail is not authorized 550-5.7.1 to send email directly to our servers

I am new to DO and I have tried to look for solution online but I didn't find any answer. I am using Ubuntu OS 20.04(LTS)X64 version.
My question is that I have 2 droplets, MailServer droplet where I have installed docker composer and mailcow to run mail mails, and another droplet named WebServer hosting my domains. I have also set up all required DS records under my domain added on WebServer droplet and pointed A record mail.mydomail.com to the IP of mail server droplet. However, whenever I try sending emails they all bounce back unless the ones sending between mydomain users(user1#mydomain.com & user2#mydomain.com). It just says that "The IP you're using to send mail is not authorized.....".
Any support to help me solve this issue will be highly appreciated. An I am wondering if that approach is possible or if there is any documentation on how someone can set up dns records on one server and configure mailserver on another server using digitalocean.
Here is how I set my DNS on mydomain.com to point to MailServer IP

I can't connect my email to my email client (VPS - CyberPanel)

i have a server on RackNerd, after I successfully installed Cyberpanel, and my website was online, I created an email on Cyberpanel. Then I connected via my email client (MailBird) but it was always rejected, I have entered the data correctly, such as "Server Hostname", "username" and "password" for my email.. What should I do?
By simply saying it was always rejected doesn't provide enough information to debug your issue. Though you could try these:
Mail server SSL is issued
Postfix & Dovecot is running properly
All mail related ports are open in the firewall

Sendmail Relay Issue

I have installed sendmail on Centos 7 and setup relay server using SMART_HOST.
But sendmail is not using my relay server when sending email, it keeps using localhost.
Can anyone help me to solve this problem?
Sendmail-8.12+ by default relays messages submitted locally to local main sendmail daemon running at 127.0.0.1:25. It does it as a security precaution to avoid installation as set root uid.
Have you checked sendmail log files? They should show where main local sendmail daemon relays messages to non local email addresses.
Documentation: SECURITY file in sendmail distribution
I found the answer myself.
The mistake was with LOCAL_DOMAIN.
I had put my local domain (which was used for mail server and email address) here.
And all of my emails were being handled as local emails.
Local emails were meant for excluding from relay, lol.

ssmtp: 550 invalid DNS MX or A/AAAA resource record

I am trying to send a mail from centos machine, but I came to a problem. I have installed "mail" and ssmtp inside my linux machine and I got this response when I try to send a mail.
ssmtp: 550 invalid DNS MX or A/AAAA resource record
FromLineOverride=YES
mailhub=smtp.1und1.de:587
UseSTARTTLS=YES
Of course, with the correct password and user.
I have tried already couple of users and everybody are returning the same.
I have tried even with my own user and the password that I have, but it won't work.
If you have any other approaches to this problem let me know also.
What am I doing wrong ?
The problem seems to be the FROM address for the SMTP envelope. Some SMTP servers will ignore an invalid value like Gmail for example (that's why it worked for me with Gmail) but if you're using 1und1 SMTP-Server you have to override the domain if it's not the same as the mail domain (e.g. if you're on a local test server).
You can override the domain in the /etc/ssmtp/ssmtp.conf:
Assuming your email is: my#yourdomain.de
rewriteDomain=yourdomain.de

Plesk, Email with localy established domain where the mail server is external

i have a big problem with the setup for an Domain.
The Webservices are established on our Server but the Mail functions are on a Server of an other Company when we now want send an Email over our Server he tried to send it localy insted of sending it to an other server so he give back an no account here error.
Thanks for helping me out and friendly greetings.
Edit: OS Debian 6
Imap: Courier
Send: Postfix
CP: Plesk
Further to this, we are using Plesk 11.5.3 on a setup where a single mail service is activated for all domains.
So each domain cannot have the mail service turned on or off individually.
We had the same problem as Franco, and we fixed this by running the following command for each domain that had external email:
# /usr/local/psa/bin/mail --off domain.com
Works perfectly, and removes any previously created local email addresses from Postfix.
"The problem is because the server will attempt to deliver emails for the domain name locally by default. To resolve that problem you would need to set it to use the domain name's MX record."
The simple answer is to disable mail services for the subscription.
Untick the box for "Activate mail service on domain".