Search code examples
configurationgmailmsmtp

Can't receive email with msmtp using google account


I'm experiencing issue with msmtp on my backup server (OpenSUSE 12.2). I'm trying to send email everytime some of my backups fail. For this reason I would like to use msmtp. I have everything setted up. However, even though I see sent items in my "Sent" AND "Inbox" folder in Gmail, I never received single email on my desired Email account. Could anyone help me please? Scripts follow bellow. Please see that recipient is my gmail acc in log even though in text.txt is different.

.msmtprc

account default
host smtp.gmail.com
port 587
protocol smtp
from [email protected]
tls on
tls_starttls on
#tls_trust_file /etc/ssl/certs/ca-certificates.crt
tls_certcheck off
tls_nocertcheck
auth on
user [email protected]
password Mypassword
logfile ~/.msmtp

.msmtp

Feb 25 09:44:28 host=smtp.gmail.com tls=on auth=on [email protected]
[email protected] [email protected] mailsize=130 smtpstatus=250 
smtpmsg='250 2.0.0 OK 1393317868 g1sm73904348eet.6 - gsmtp' exitcode=EX_OK

text.txt

From: Daily backups <[email protected]>
To: Recipient's Name <[email protected]>
Subject: Backup report
Sample text

Command for send email

$ cat text.txt | msmtp -a default [email protected]

Big thank to all of those who will try to help me. David


Solution

  • This works for me....

    account default
    host smtp.gmail.com
    port 587
    logfile /tmp/msmtp.log
    tls on
    tls_starttls on
    tls_trust_file /etc/ssl/certs/ca-certificates.crt
    
    auth login
    user [email protected]
    password MyPassWord1
    from First LastName
    
    account account2
    

    And then from raspberry Pi command line

    echo -e "Subject: Test Mail\r\n\r\nThis is a test mail" |msmtp --debug --from=default -t [email protected]