Results 1 to 4 of 4

Thread: I'm in mail-server hell.

  1. #1
    Join Date
    Mar 2004

    I'm in mail-server hell.

    Hi folks, I was wondering if anyone could help me out of mail-server setup hell.

    I'd been putting off setting up my mail server for quite some time now. I had a try years ago and just got completely bamboozled my all this strange talk of using "M4" to create configuration files. I'd only really delt with configuration via the "./configure --opts=args" command-line style and the configuration file style like that of my.cnf of mysql and httpd.conf of the Apache http server and so on. So I couldn't really make head nor tail of writing a .mc configuration file and then "using the M4 preprocessor to generate a .cf configuration file" and so on. It all had me rather confused.

    However, now that I'm finally getting somewhere with building my site, I want to set up email on it properly so I can use addresses from my domain. As much as I want to use email from my domain in the normal way, I also want it available for automated mail too. It's rather annoying that every mail my system sends out gets thrown straight in the bin simply because I can't get incoming mail to be accepted.

    At first, I asked my hosting provider to set it up for me. I asked them to install and configure the necessary software for my domain to be able to send and recieve email and then leave me the information I need to be able to add, edit and delete accounts as and when I desire. I also told them to keep sendmail installed because I know that's the program PHP uses to send mail out. So they went ahead and uninstalled sendmail, installed something else in its place and then gave up trying to figure it out and just gave me a link to the "manual" for configuring the now-uninstalled sendmail via one of those awful web-based host account administration panels (y'know, like cPanel and all that crap).

    So, with my mail software thoroughly decimated, I saw no other option but for me to try and fix everything myself. Luckily I got sendmail reinstalled pretty quickly. The OS on my VPS is Debian, so it was just a case of a quick "apt-get install sendmail" and it chucked out the MTA the support staff put on and put Sendmail back in its place. Unfortunately for me, however, it seems that the installation apt-get found and installed is broken by default. It wasn't anything too major, though. Just enough to force me to have to figure out what all this "M4" talk was about and re-order a few things in the config files. So, I now have a reasonable enough understanding of the basics of how configuring Sendmail using M4 works and I once again have a working local MTA. So things like
    echo "Body text of a mail message." | mail -s "Subject text of a mail message" user
    echo "Body text of a mail message." | mail -s "Subject text of a mail message" user@domain.com
    work fine (although like I said, the one to a user on another domain like gmail.com or hotmail.com gets thrown straight into the trash/spam bucket).

    After much reading of documentation and various other sources of information, I then found that having Sendmail installed is only half of the job. I also needed a POP3 server to recieve mail from a remote client and then pass it on to Sendmail as if it was from a local user because Sendmail has no authentication mechanism and so can be either an open relay for mail from the entire internet (not good), a relay for specified domains and static addresses (better, but still entirely useless) or closed and relaying mail from local users only. So after a bit of looking around and reading, I decided to Go with Dovecot as my POP3 server. I've installed and configured it in so far as I can now connect to my domain via Dovecot and retrieve mail from the /var/mail/$USERNAME files, but I still can't send outgoing mail and recieve incoming mail from another domain.

    I think everything would work if I could just get one last thing done, but I can't find out how. I think all I need to do now is enable Dovecot to listen on ports 25 and 465 so that it can relay incoming mail to Sendmail locally.

    telnet stephenphilbin.com 25
    begins connecting, but then does nothing until the connection times out and
    telnet stephenphilbin.com 465
    gets the connection refused immediately, so I'm guessing there's nothing listening on 465 and
    netstat -nlp | grep 25
    confirmed my suspicion that Sendmail is listening on 25. Sendmail doesn't trust any external domains for relaying mail, though, so I'm guessing that's why nothing happens until the connection times out. It also means that it's listening on a port it has no need to listen on and is blocking Dovecot from listening on 25 too.

    So I guess my question is, does anyone know how to get Sendmail to stop listening on port 25? The only thing I've seen which I think might be a likely candidate is the line
    at the end of my main Sendmail configuration file. I suspect that removing this might stop Sendmail listening on 25, but I suspect it might also stop Sendmail relaying mail on to other domains too. I've been reading the Sendmail documentation (yet again) but I can't make a lot of sense of most of what I've read so far.

    I'll also still need to find how to get Dovecot to listen on 25 and 465, but my primary concern, for now, is just getting Sendmail to stop listening on 25 without stopping it from relaying via SMTP to other domains.
    I'm thuper, thanks for asking.

    It lives! http://www.stephenphilbin.com/ (Well it kinda' does anyway).
    My portable colour selection tool

  2. #2
    Join Date
    Aug 2007
    Configuring Sendmail is really throwing yourself in the deep end. If you want to make life a bit easier for yourself, you could start by using Postfix rather than sendmail.

    You can use the unix alternatives command to change mail servers from sendmail to postfix if postfix is installed. It will provide symbolic links mapping the sendmail app names to the postfix app names so it won't break any applications trying to send mail.

    Postfix is loads easier to configure - the commands are somewhat less obfuscated than sendmail - but it maintains quite a lot of compatibility with sendmail.

    There's a document http://www.freespamfilter.org/FC4.html which is great for configuring postfix. Although it refers to Fedora Core 4, a lot of the postfix configuration is typical. Some is deprecated now. There's also a bunch of postfix/dovecot howtos available.

    Sendmail/postfix need to listen on port 25 in order to transfer mail to other mail servers and for local clients to send mail. Dovecot shouldn't be playing with port 25 at all.

  3. #3
    Join Date
    Mar 2004
    Yeah, I know I'm throwing myself in at the deep end here, but I kinda' prefer it this way anyway. I did the same thing when I first started with Linux. I chucked out the rpm installations of Apache, PHP, MySQL and so on and then installed them from source instead. It took me two weeks to get MySQL installed the first time, but the knowledge gained from that ordeal has served me well ever since.

    I'm OK with the M4 config method now, it just seemed a bit alien and rather pointless (I always have difficulty understanding the concept of something if I consider it to be pointless). I'm just a little wobbly on the process of outbound mail sent from a non-local client and inbound mail recieved via SMTP.

    My understanding was that the MTA (Sendmail) normally accepts mail and (at the most basic level) does one of two things with it. It looks at the address of the intended recipient and if there is either no domain name (because it's from a local source) or there is a domain name wich resolves to the local host, it hands the mail off to the local LDA for delivery into the intended recipient's inbox. However if there's a domain name that resolves to an external host it does an MX lookup and sends it to the external host via SMTP. So an incoming mail not intended for a local user effectively bounces off the MTA to where it's supposed to go, but incoming mail intended for a local user gets swallowed and delivered locally.

    After a little reading about POP3 servers I got the impression that because of all the spam on the net it was no longer safe to leave your MTA open and listening on 25 because then it's basically an open relay. So I got the impression that you were supposed disable your MTA from listening on 25 for remote connections and use the POP3 server to not only retrieve recieved messages, but authenticate a remote client and take its mail for delivery to the MTA as a local client (thus bypassing the MTA's inability to authenticate users but still allow outbound mail), but I'm getting the impression this is wrong. If that was the case, then it would cause problems for inbound mail too. A client sending mail to me would have to authenticate as a local user just to send a mail to me which obviously makes no sense.

    I did some more reading and found that this timing out when doing "telnet stephenphilbin.com 25" is likely to be down to the ISP I'm connecting from blocking port 25 (to stop spam coming from their networks). I've been working on my laptop away from home for the past few weeks and getting timed out every time. I used ssh to connect to my computer at home to try to telnet my server through my own ISP at home, but I also got the same timeout there.

    After a bit more reading I saw quite a few suggestions saying that using "SMTP auth" would get rid of this problem of ISPs blocking port 25. Am I on the right track with this "SMTP auth" thing or am I on another wild goose chase here?

    Oh and am I to understand that the POP3 server is for nothing more than retrieveing mail delivered (via the LDA) to inboxes on the host? If that's the case, then surely all I need is to set up this "SMTP auth" thing (assuming it's not a wild goose chase) and all will be well?
    Last edited by Stephen Philbin; 09-03-2007 at 08:19 AM.
    I'm thuper, thanks for asking.

    It lives! http://www.stephenphilbin.com/ (Well it kinda' does anyway).
    My portable colour selection tool

  4. #4
    Join Date
    Mar 2004

    Just a quick update to say that I've confirmed that the ISP I'm currently accessing the web from is indeed blocking port 25. I used telnet to try to connect to both stephenphilbin.com and smtpauth.earthlink.net on port 25 from my laptop and they both timed out. Then I tunneled to my computer back home, ran the same telnet commands and they both connected with no time outs. The connection was still rejected at stephenphilbin.com, but it at least didn't time out. So I ran netstat -nlp | grep 25 again and noticed that sendmail was listening on port 25 like I made sure it was before, but it's listening on

    Presumably I just need to configure Sendmail to listen on and reject mail that doesn't originate from, or terminate at stephenphilbin.com and I'm all set then?
    I'm thuper, thanks for asking.

    It lives! http://www.stephenphilbin.com/ (Well it kinda' does anyway).
    My portable colour selection tool

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.10855 seconds
  • Memory Usage 2,888KB
  • Queries Executed 13 (?)
More Information
Template Usage (33):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (6)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (4)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (70):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • bbcode_parse_start
  • postbit_imicons
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates