stretch perfect server => understanding mail (+problem solving)

Discussion in 'Installation/Configuration' started by jbonlinea, Sep 19, 2017.

  1. jbonlinea

    jbonlinea Member

    Hi there,
    I freshly installed the Debian 9 perfect server and added php5.6 following this tuto.
    Everything went smoothly, I created my vhosts in ISPConfig, ftpuser, database, etc. excellent !

    Now I'm facing two issues :
    • I don't really get how to deal with email, at large ; I mean, how postfix, roundcube, mailman and ISPConfig are intertwined
    • I can't sent email using the php mail() function
    If I had a better understanding of the broad situation, I may solve/understand why I can't send email with the php mail() function.

    at the moment my understanding is that :
    • postfix is a mail server ; what send and receive email, at least, and most probably where email accounts are created...
    • ISPConfig has a pretty furnished email tab. I assume it serves as a gui to create email account in postfix, and such.
    • Roundcube is a gui, it do not do nothing per se, do not have user account, and rely on something else ; I assume it only fetch user account, email, etc from the mail server ? postfix ? right ?
    • mailman a mailing list manager ; it thus need postfix to send email (or receive it as I've seen that it's also managing email discutions) ; I assumed ISPConfing use mailman to you create a mailing list
    Ok, this said, here comes the gaps !
    So Any explainations or directions toward a comprehensive tutorial would be welcome, especially if it is related to the perfect server usage !

    I normally use php mail() function without much thinking, in order to test if email was working I uploaded a testmail.php file on both of my vhost (one with each php versions)
    "[email protected]";
    "this script send an email to $testemailrecipient";
    mail($testemailrecipient"test email 1""it work's, thank's");
    However I haven't received any email :-(

    I had a look and have seen plenty of post about php mail() function not working, however what I've tried isn't working and I don't know if and how it is intertwined with postfix, or ISPConfig.

    For instance I tried to restart amavisd by typing "service amavisd start" and "service amavisd-new start", nothing happened, then with "systemctl start amavisd.service" but i got "Failed to start amavisd.service: Unit amavisd.service not found."

    in the mail.log I can see that clamd fail to connect somewhere, but I don't know why, and it's one among quite few things I don't totally understand
    here are some 80+ line of /var/log/mail.log

    Actually I don't even know some of these basics.
    Do I have to add a domain and a mailbox in ISPConfig to be able to sent an email ?
    The registar of is OVH, to my understanding I have nothing to do to use php mail(), however, if I add a mailbox in ISPConfig, let's say [email protected] I guess it won't work out of the box. do I have to add mx entries to my zone ? if my registar only offers me one meail account, can I create more account like [email protected], or [email protected], and use it to sent, receive emails ?

    These are intertwined question to me and this is just the top of the iceberg.

    I hope one of you can empower me a bit and help me to use php mail().

    Thank's in advance.

    Attached Files:

  2. till

    till Super Moderator Staff Member ISPConfig Developer

    I guess you might have a typo in the postfix file. Check that you did not miss to remove the # in front of the smtps and the submission lines.
  3. jbonlinea

    jbonlinea Member

    thank's for your quick reply.
    I did uncommented the three first lines of each submissions and smtp and copied-pasted the fourth as mine was different.

    here is my file content

    Attached Files:

  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Like I said, you missed to remove the # in front of the smtps and submission line. Take a look at the tutorial, there you can see that there is no # in front of the line:

    submission inet n - y - - smtpd


    smtps inet n - y - - smtpd
  5. Tuumke

    Tuumke Active Member

    #submission inet n - y - - smtpd
    #smtps inet n - y - - smtpd
  6. jbonlinea

    jbonlinea Member

    Ho, spagetti, I'm so dumb !

    Well done, but, sadly, there is a lot to say still !

    The (not so funny) part: actually it worked before I edited the postscrit conf file as you recomended !
    The mail were actually in the spam !
    I used the same testmail.php script yesterday on my synology and the mail did not end in the spam, but now I realize that on my synology I use the smtp server of OVH to send emails...

    So two/three questions
    • for the sake of learning, how did you identified that I missed to uncomment the two first lines ?
    • what cause this mail ending in the spam ? What should be done to avoid so ?
  7. HSorgYves

    HSorgYves Active Member HowtoForge Supporter

    You posted your, people do actually read what you write to be able to help ;-)
    For the second answer you should check your spam headers and explain more about your spam settings.
  8. jbonlinea

    jbonlinea Member

    yes indded people do read, however till suggested that I had a typo in my before I send it, he must have understood from my mail.log file or made a clever hypothesis from usual mistakes.

    for the spam header, I'll come back to you later ;-)

  9. till

    till Super Moderator Staff Member ISPConfig Developer

    Your mail.log contains ssl errors for localhost connects, This is an indication that you accidentally activated tls for the smtp part which is what happens when the smtps and submission lines are commented out while you removed the comments from the other options.
  10. jbonlinea

    jbonlinea Member

    ok this was you clue !

    thank's it realy helps learning reading the logs !

    do you have any reading recommendation on the broad functioning of the mail set-up and the intertwining between postfix, amavis, dovecot, ISPConfig, mailman and roundcube ?

    Thank's again
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    There are no specific documents that I can recommend.

    The setup is a standard virtual user postfix setup with amavis. The mail flow when you receive a mail is:

    Internet -> Postfix > Amavis -> Postfix -> Dovecot

    Mailman is basically just a client that sends and receives mail and RoundCube is just a normal mail IMAP client too, not different from e.g. outlook or thunderbird, the only difference is that it has a web UI and not Windows or Linux UI.
  12. jbonlinea

    jbonlinea Member

    roundcube, ok
    mailman, i'll have a look at the doc, i'll probably make it through without much fuzz,

    as standard as it might be, this is pretty new to me, some readings would help
    then the mail tab of ISPConfig is just a UI to administer ??? postfix ? right ? if not what ?

    Thank's again
  13. ISPConfig Developer ISPConfig Developer

    yes, ISPConfig just manages the entries in your database and allow seperation of controls for various customers for example.

    edit: "just" is probably correct, but wanted to show some respect - "just" just does not represent the value ISPConfig offers ;)
  14. jbonlinea

    jbonlinea Member

    yes indeed, ISPConfig is definietly a powerfull and enabling tool, both for what it is and because of the great how-to-forge tutorials and support community !

    I would have loved and explication of what may be a "standard virtual user postfix setup with amavis" and of the mail flow such as "Internet -> Postfix > Amavis -> Postfix -> Dovecot"
    but this is indeed not ISPConfig related, and I'll find some time to look for it one of theses days ;-)
  15. ISPConfig Developer ISPConfig Developer

    yes, that's explained all over the web and would be far beyond basic support, except someone really loves to take the time though.
    It depends on how detailed the explanations would be however...

    quick, maybe not so good idea of how it works:

    postfix listens for incomind connections, if it got some valid email ( checking all the variables like is the mailbox the mail is for valid using the mysql-database ) he sends that to amavis for further checking.
    amavis then sends that mail to clamav for virus checking, aswell to spamassasin for spam detection/tagging and does a check if the DKIM signature is valid.
    after all that amavis sends the data back to postfix, which is listening on another instance special for that case, and hands it over to dovecot to put that mail nicely into users account :)

Share This Page