Find the answer to your Linux question:
Results 1 to 9 of 9
Hi, I am pretty new to linux and am in the process of moving from shared webhosting to running my own dedi. I am running Debian and have successfully managed ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2007
    Posts
    5

    Route all mail to one email address.


    Hi,

    I am pretty new to linux and am in the process of moving from shared webhosting to running my own dedi.

    I am running Debian and have successfully managed to get Apache2/PHP5/MySQL5 all running fine.

    My problem is, that on my old account all unrouted mail was forwarded to my ISP email address. As I had no email accounts set up mail sent to *@mydomain.com was sent to my ISP email account.

    Now I have moved my domain over to my dedi I am wanting to have the same setup, however, I can not work out how to do this.

    Does anyone have any ideas? Currently I only have sendmail, no mail server.

    Thanks,

    Matt.

  2. #2
    Linux Engineer adrenaline's Avatar
    Join Date
    Aug 2004
    Location
    Seattle, Washington
    Posts
    1,058
    sendmail is a mail server silly, but it is a smtp server so you will need a pop server to recieve mail such as dovecot. Dovecot does pop3 and imap.

    If you have that then you need to set up your MX records with whoever does your DNS.

    Once your mail knows where to go you will be good to go

    nslookup should tell you where mail is going

    nslookup mail.yourdomain.com
    should resolve your mail server IP address.

    Make sense?
    Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
    -- Linus Torvalds

  3. #3
    Just Joined!
    Join Date
    Apr 2007
    Posts
    5
    My MX record is set up fine I think.

    I am not wanting to get mail from my isp account into my mailbox on my dedi, but I want all mail sent to my dedi's domain (*@mydomain.com) to be automatically routed to my ISP address.

    Basically I want mail sent to *@mydomain.com to be forwarded to myname@isp.com.

    You might have just told me how to do that, but I don't think so.

    Thanks,

    Matt.

  4. #4
    Linux Engineer adrenaline's Avatar
    Join Date
    Aug 2004
    Location
    Seattle, Washington
    Posts
    1,058
    Oh well there are a couple of ways to do this.

    Do you want to route all mail to your username to your ISP? Or do you want to route all mail to the ISP? If you are going to forward all mail why have a mail server.

    Here is one way to do it.

    create a user account say joe

    IN your /etc/mail directory you have a folder called.
    virtualusertable

    edit that file and in it put in

    joe <tab><tab> yourisp.com

    then save
    type make
    then restart sendmail
    /etc/init.d/sendmail restart
    then all mail to joe will go to your isp account.

    If you want to be a gateway you can edit your mail to work as a smtp gateway and it can send all your mail to a certain place. I don't know that on top of my head and I am not going to look it up if that isn't your intention. <--the reason someone might do this is to filter spam without taking a hit on the actual mail server. No point if you are running your own server.

    You can also do a forward in your users home directory but I don't know the format as I use the virtualusertable myself.
    Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
    -- Linus Torvalds

  5. #5
    Just Joined!
    Join Date
    Apr 2007
    Posts
    5
    Thanks, that looks like what I'm after.

    However I currently have no 'virtualusertable' file in /etc/mail - should i just create it? Or do I need something installed?

    Finally, I would like mail to:

    *@mydomain.com to be routed to myname@isp.com

    But there are other domains pointed to this server too (for virtual apache servers), I do not want mail sent to those domains to come to me.

    Thanks for the help,

    Matt.

  6. #6
    Linux Engineer adrenaline's Avatar
    Join Date
    Aug 2004
    Location
    Seattle, Washington
    Posts
    1,058
    vi /etc/mail/sendmail.cf

    search for DS

    # "Smart" relay host (may be null)
    DS<ip-address to relay>

    restart sendmail.


    This is what you will need to do to relay to your ISP, but your ISP will have to allow your machine to relay.

    If you want to just receive emails at your ISP account you will have to receive them on your server then forward them to your ISP.

    Make sense?
    Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
    -- Linus Torvalds

  7. #7
    Just Joined!
    Join Date
    Apr 2007
    Posts
    5
    Yeah that makes sense.

    But my ISP wont allow me to relay, so I need my machine to receive it and then forward it along, like you can in cPanel (which I dont have as its rather expensive).

    Do you know how I could do this?

    Thanks,

    Matt.

  8. #8
    Linux Engineer adrenaline's Avatar
    Join Date
    Aug 2004
    Location
    Seattle, Washington
    Posts
    1,058
    definitely

    post this for me
    ls -la /etc/mail

    what distro are you running?
    Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
    -- Linus Torvalds

  9. #9
    Just Joined!
    Join Date
    Apr 2007
    Posts
    5
    Code:
    Debian-31-sarge-32-minimal:/# ls -la /etc/mail
    total 248
    drwxr-sr-x  7 smmta smmsp  4096 2007-04-13 19:09 .
    drwxr-xr-x 65 root  root   4096 2007-04-14 13:58 ..
    -rw-------  1 root  root   4211 2007-04-13 11:40 access
    -rw-r-----  1 smmta smmsp 12288 2007-04-13 11:40 access.db
    -rw-r--r--  1 root  root    281 2006-12-09 05:22 address.resolve
    lrwxrwxrwx  1 root  smmsp    10 2007-04-13 11:40 aliases -> ../aliases
    -rw-r-----  1 smmta smmsp 12288 2007-04-13 19:10 aliases.db
    -rw-r--r--  1 root  smmsp     6 2007-04-13 19:09 aliases.lock
    -rw-r--r--  1 root  root   3122 2007-04-13 11:40 databases
    -rw-r--r--  1 root  root   5594 2006-12-09 05:23 helpfile
    -rw-r--r--  1 root  smmsp    20 2007-04-13 11:40 local-host-names
    drwxr-sr-x  2 smmta smmsp  4096 2007-04-13 11:40 m4
    -rwxr-xr--  1 root  smmsp  9749 2007-04-13 11:40 Makefile
    drwxr-xr-x  2 root  root   4096 2007-04-13 11:40 peers
    -rw-r--r--  1 root  smmsp    16 2007-04-13 11:45 relay-domains
    drwxr-xr-x  2 root  smmsp  4096 2006-12-09 05:22 sasl
    -rw-r--r--  1 root  smmsp 63874 2007-04-13 11:45 sendmail.cf
    -rw-r--r--  1 root  smmsp   269 2007-04-13 11:40 sendmail.cf.errors
    -rw-r--r--  1 root  root  11888 2007-04-13 11:40 sendmail.conf
    -rw-r--r--  1 root  smmsp  4103 2007-04-13 11:40 sendmail.mc
    -rw-r--r--  1 root  root    149 2006-12-09 05:22 service.switch
    -rw-r--r--  1 root  root    180 2006-12-09 05:22 service.switch-nodns
    drwxr-sr-x  2 smmta smmsp  4096 2007-04-13 11:40 smrsh
    -rw-r--r--  1 root  smmsp 43629 2007-04-13 11:40 submit.cf
    -rw-r--r--  1 root  smmsp  2284 2007-04-13 11:40 submit.mc
    drwxr-xr-x  2 smmta smmsp  4096 2007-04-13 11:40 tls
    -rw-r--r--  1 root  smmsp     0 2007-04-13 11:40 trusted-users
    Running Debian (shown in the first line).

Posting Permissions

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