Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: mailx is not working

  1. #1

    Default mailx is not working

    Hey,

    I am running a opensuse 11.4 with mailx 12.2. I am trying to sent emails via command line using mailx. I have not configured any mail server in yast. My .mailrc in my homefolder looks like this:

    set smtp-use-starttls

    account gmx {
    set smtp=mail.gmx.net:465
    set smtp-auth=login
    set smtp-auth-user=my.name@gmx.de
    set smtp-auth-password=mypassword
    set from="My name <my.name@gmx.de>"
    }

    Unfortunately when I use the command

    mailx -s"Test" -A gmx my.name@gmx.de [Return]
    Hallo
    [ctrl+d]

    I am getting only the message

    Unexpected EOF on SMTP connection
    "/home/myname/dead.letter" 11/338
    . . . message not sent.

    Does anyone know where the bug is.

    Thanks a lot

    Rexi

  2. #2
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    15,676
    Blog Entries
    3

    Default Re: mailx is not working

    "mailx" is only part of the story.

    "mailx" is an MUA (Mail User Agent). It is used to read mail that you receive, and to compose mail that you will send.

    The other part of the story is the MTA (Mail Transfer Agent). The MTA is responsible for transferring the message to the destination system.

    In a typical opensuse install, the MTA used is postfix. However, postfix requires some configuration. Have you done that yet?

    The simplest setup is when your ISP has a mail server to which your mail can be sent, and the ISP handles it from there. As I recall, setting up postfix is fairly simple once you know the identity of the ISP server. (Personally, I am not using postfix and don't have it installed, so I can't give details on setting that up.

    If you get into Yast, there should be a section for network services. And you should be able to configure postfix there.

    In case I haven't been clear, your problem is almost certainly with the MTA rather than with mailx.
    openSUSE Leap 15.3; KDE Plasma 5.18.6;

  3. #3
    Will Honea NNTP User

    Default Re: mailx is not working

    rexi76 wrote:

    >
    > Hey,
    >
    > I am running a opensuse 11.4 with mailx 12.2. I am trying to sent
    > emails via command line using mailx. I have not configured any mail
    > server in yast. My .mailrc in my homefolder looks like this:
    >
    > set smtp-use-starttls
    >
    > account gmx {
    > set smtp=mail.gmx.net:465
    > set smtp-auth=login
    > set smtp-auth-user=my.name@gmx.de
    > set smtp-auth-password=mypassword
    > set from="My name <my.name@gmx.de>"
    > }
    >
    > Unfortunately when I use the command
    >
    > mailx -s"Test" -A gmx my.name@gmx.de [Return]
    > Hallo
    > [ctrl+d]
    >
    > I am getting only the message
    >
    > Unexpected EOF on SMTP connection
    > "/home/myname/dead.letter" 11/338
    > . . . message not sent.
    >
    > Does anyone know where the bug is.


    I use pretty much the same code to send notices from a remote machine. The
    only difference I see in your code is here:

    CODE
    -----------
    smtp=mail.gmx.net:465
    -----------
    /CODE

    where mine is

    /CODE
    -----------
    smtp=smtp://mail.whonea.net:587
    -----------
    /CODE

    Note the protocol spec on the smtp server address. I just checked and my
    script also fails w/o the smtp:// spec on the server url.

    I had so much trouble getting this set up that I still have the paremeters
    inline rather than an an account clause - it took me a while to get it right
    but then I'm a real novice at bash scripting.

    --
    Will Honea

  4. #4
    Will Honea NNTP User

    Default Re: mailx is not working

    Will Honea wrote:

    > rexi76 wrote:
    >
    >>
    >> Hey,
    >>
    >> I am running a opensuse 11.4 with mailx 12.2. I am trying to sent
    >> emails via command line using mailx. I have not configured any mail
    >> server in yast. My .mailrc in my homefolder looks like this:
    >>
    >> set smtp-use-starttls
    >>
    >> account gmx {
    >> set smtp=mail.gmx.net:465
    >> set smtp-auth=login
    >> set smtp-auth-user=my.name@gmx.de
    >> set smtp-auth-password=mypassword
    >> set from="My name <my.name@gmx.de>"
    >> }
    >>
    >> Unfortunately when I use the command
    >>
    >> mailx -s"Test" -A gmx my.name@gmx.de [Return]
    >> Hallo
    >> [ctrl+d]
    >>
    >> I am getting only the message
    >>
    >> Unexpected EOF on SMTP connection
    >> "/home/myname/dead.letter" 11/338
    >> . . . message not sent.
    >>
    >> Does anyone know where the bug is.

    >
    > I use pretty much the same code to send notices from a remote machine.
    > The only difference I see in your code is here:
    >
    > CODE
    > -----------
    > smtp=mail.gmx.net:465
    > -----------
    > /CODE
    >
    > where mine is
    >
    > /CODE
    > -----------
    > smtp=smtp://mail.whonea.net:587
    > -----------
    > /CODE
    >
    > Note the protocol spec on the smtp server address. I just checked and my
    > script also fails w/o the smtp:// spec on the server url.
    >
    > I had so much trouble getting this set up that I still have the paremeters
    > inline rather than an an account clause - it took me a while to get it
    > right but then I'm a real novice at bash scripting.


    Just noticed that I skipped over a parameter. I also use

    CODE
    -------
    -S ssl-verify=ignore
    -------
    /CODE

    that would go into your account clause as

    CODE
    --------
    set ssl-verify=ignore
    --------
    /CODE

    --
    Will Honea

  5. #5
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,683
    Blog Entries
    4

    Default Re: mailx is not working

    Actually he's connecting to mail.gmx.de at port 465 directly which is allowed. However port 465 assumes TLS encrypted sessions and according to the mailx man page you need the syntax smtps://mail.gmx.de:465.

    There are two possible methods to get SSL/TLS encrypted
    SMTP sessions: First, the STARTTLS command can be used to
    encrypt a session after it has been initiated, but before
    any user-related data has been sent; see
    smtp-use-starttls above. Second, some servers accept
    sessions that are encrypted from their beginning on. This
    mode is configured by assigning smtps://server[:port] to
    the smtp variable.

  6. #6
    Will Honea NNTP User

    Default Re: mailx is not working

    Will Honea wrote:

    > Just noticed that I skipped over a parameter. I also use
    >
    > CODE
    > -------
    > -S ssl-verify=ignore
    > -------
    > /CODE
    >
    > that would go into your account clause as
    >
    > CODE
    > --------
    > set ssl-verify=ignore
    > --------
    > /CODE
    >


    Trying to clean up my script, I see that you set smtp-use-starttls outside
    of the account definition and not in the mailx arguments - you sure that
    works? Try moving it inside the account gmx definition or onto the mailx
    command line.

    --
    Will Honea

  7. #7
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,683
    Blog Entries
    4

    Default Re: mailx is not working

    Ports 465 and 587 have different behaviour. 465 assumes it is TLS always so the protocol is smtps. 587 requires a STARTTLS command to switch so the protocol is smtp. However the server may reject the connection if no STARTTLS is issued before authenticating and uploading mail, for security reasons.

  8. #8
    Will Honea NNTP User

    Default Re: mailx is not working

    ken yap wrote:

    >
    > Ports 465 and 587 have different behaviour. 465 assumes it is TLS always
    > so the protocol is smtps. 587 requires a STARTTLS command to switch so
    > the protocol is smtp. However the server may reject the connection if no
    > STARTTLS is issued before authenticating and uploading mail, for
    > security reasons.


    Told you I was a novice at this, didn't I? Took me a week to get the script
    working to get my external IP address, check against the last one I had,
    then email a message containing the new IP if it had changed. Along the way
    I dug up a lot of documentation but never did find a coherent description of
    the email systems. Do you have some you could recommend?

    --
    Will Honea

  9. #9
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,683
    Blog Entries
    4

    Default Re: mailx is not working

    I sort of worked it out by trial and error also. Probably the best references are the RFCs defining the use of these ports: 465 = smtps (actually deprecated), 587 = submission. Note that some servers also support STARTTLS on port 25. I know that gmail does, which is useful when you find that 587 is not usable for some reason. STARTTLS is sort of an add-on to an existing port, it is just another command that can be supported with the extended command set of ESMTP.

  10. #10

    Default Re: mailx is not working

    Thanks for the hints. By crossclassifying all proposal I found out the following

    It works:

    account gmx {
    set smtp-use-starttls
    set smtp=smtp://mail.gmx.net:587
    set smtp-auth=login
    set smtp-auth-user=my.name@gmx.de
    set smtp-auth-password=mypassword
    set from="My name <my.name@gmx.de>"
    }

    It works not:

    account gmx {
    set smtp=smtps://mail.gmx.net:465
    set smtp-auth=login
    set smtp-auth-user=my.name@gmx.de
    set smtp-auth-password=mypassword
    set from="My name <my.name@gmx.de>"
    }

    The error message then is: smtp-server: 554 5.5.1 This session already uses TLS {mp036}

    Thanks

    rexi

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •