Email with msmtp not working



  • Hi all,

    I have been having fun installing a USB for the root file system and installing PHP5, which all works very well but there isn't any sendmail program in the package, so a closer look on the openwrt web page tells me that I have to install mailsend instead..

    opkg update
    opkg install msmtp
    

    This installs just fine and then I edit the config file for my smpt server. The server details are here:
    Protocol: POP3 with SSL

    Server/Hostname/Address: mail.uk2.net
    Username: you@yourdomain.com
    Password: Your Password (Can be reset in Dashboard or CHI)
    Incoming Port: 995
    Outgoing Port: 465
    Outgoing Server Requires Authentication
    SSL: Enabled
    Secure Password Authentication: No

    I then set up the config file at /etc/msmtprc like this:

    $cat /etc/msmtprc 
    
    account default
    
    host mail.uk2.net
    port 465
    auth on
    user user@my domain here.com   <-- my real username login here
    password ***  <--  My real password here
    logfile /var/log/msmtp.log
    
    

    when I run the following command with real email addresses, I get the following:

    # echo -e "Subject: Test Mail\r\n\r\nThis is a test mail, please let me know if it works..!" |msmtp --debug 
    --from me@my domain.com -t recepient@my domain.com
    
    
    loaded system configuration file /etc/msmtprc
    ignoring user configuration file /root/.msmtprc: No such file or directory
    falling back to default account
    using account default from /etc/msmtprc
    host = mail.uk2.net
    port = 465
    proxy host = (not set)
    proxy port = 0
    timeout = off
    protocol = smtp
    domain = localhost
    auth = choose
    user = me@my domain.com
    password = *
    passwordeval = (not set)
    ntlmdomain = (not set)
    tls = off
    tls_starttls = on
    tls_trust_file = (not set)
    tls_crl_file = (not set)
    tls_fingerprint = (not set)
    tls_key_file = (not set)
    tls_cert_file = (not set)
    tls_certcheck = on
    tls_min_dh_prime_bits = (not set)
    tls_priorities = (not set)
    auto_from = off
    maildomain = (not set)
    from = me@my domain.com
    add_missing_from_header = on
    add_missing_date_header = on
    remove_bcc_headers = on
    dsn_notify = (not set)
    dsn_return = (not set)
    logfile = /var/log/msmtp.log
    syslog = (not set)
    aliases = (not set)
    reading recipients from the command line and the mail
    msmtp: network read error: Connection reset by peer
    msmtp: could not send mail (account default from /etc/msmtprc)
    #
    

    Does anybody know why it fails and have you had any experience with mailsend?

    Thanks in advance for any input.. :-)



  • @TheLion Don't know if it is of any use to you, but there is a tutorial on the Omega Wiki concerning sending emails using Python that can be found at: https://wiki.onion.io/Tutorials/Sending-Emails-With-Python



  • Thanks.. - That did work, but like a muppet, I meant msmtp not mailsend.. Sorry, I have altered the initial post to install msmtp instead. I wish to use this because I believe it is the replacement for sendmail in PHP. I am writing a web app to send an email from the web server in PHP.

    Glad to see the email send though. If I can't get this to work, I may think about how to integrate mailsend into PHP as well.



  • Hey... I have it working tonight.. :-)

    I will do a tutorial from factory default of what I have done tomorrow as I am stopping on a high point for now and I will post a link to it from this one.

    I have made a PHP web page that has the user fill in a feedback form and email it back to my regular email account over smtp using msmtp.


Log in to reply
 

Looks like your connection to Onion Community was lost, please wait while we try to reconnect.