Results 1 to 5 of 5

Thread: how to get email from /var/spool on an email account

  1. #1
    Join Date
    Nov 2009
    Beans
    46

    how to get email from /var/spool on an email account

    hello,

    does anyone know a way (the simple the better) to receive all the email that can be found in /var/spool/mail/user to a yahoo or gmail account?

    i mean, instead of login to the server and read the messages from /var/spool/root, it will be a lot easyear and faster to found about them, if they will be sent to my email account

    i know i can make the cron output be sent by email, if i place in front of the cron line something like :
    MAILTO="email@something.com"

    but in /var/spool/mail/ for root or other usernames you can found many other messages

    so, any ideas?

    thank you!

  2. #2
    Join Date
    Sep 2007
    Location
    over there
    Beans
    2,521
    Distro
    Ubuntu

    Re: how to get email from /var/spool on an email account

    I'm afraid I don't know much about running an email server. But I would imagine that you can set your email account on the server to forward all mail to your yahoo or gmail account. This would involve accessing the settings of the email account that is on that server. Precise instructions would depend on the exact server software I should imagine.

    It also depends on how you are accessing your email. For instance, I get my mail from gmail accounts by using Evolution on my desktop machine; and I also have Evolution fetch mail from /var/spool/mail/user on the localhost. You could do something similar, but fetching it from the mail server rather than the local machine (assuming the mail server isn't the local machine - if it is, you can just do exactly what I do).

    But if you want the mail from the server to be accessible via your gmail/yahoo webmail interface, you need to tell the server to forward it.
    Last edited by t0p; January 14th, 2010 at 10:38 PM.
    "All people are scum. No matter what they look like." ~ Spider Jerusalem, Transmetropolitan #4



  3. #3
    Join Date
    Nov 2009
    Beans
    46

    Re: how to get email from /var/spool on an email account

    in /var/spool/mail you get all kind of messages.
    another very interesting file to get by email would be the one from logwatch

    the messages in /var/spool/mail/root for example are destined to root@localservername
    it would be really nice if instead of append them in this file (/var/spool/mail/root) they will go to my email account from somewhere (yahoo, or other)

  4. #4
    Join Date
    Nov 2009
    Beans
    46

    Re: how to get email from /var/spool on an email account

    I found the way to receive those emails.

    If you have messages in /var/spool/mail/ and you want to get them as soon as they are being placed there, you'll have to do this:

    - edit /etc/aliases and add a line for each username found in /var/spool/mail/
    - for example if you only want to receive email for root make sure you have these lines:

    postmaster: root
    root: you@gmail.com

    If you have other services installed, like clamav (the antivirus) which also can send emails to root, then you can have these lines:


    postmaster: root
    clamav: root
    root: you@gmail.com

    But you can also have:
    john: john@gmail.com


    Bottom line, for each user on the system you can define a redirect to another email address, or to another user on the system that will in the end send the mail to that address.

    After you are done editing the /etc/aliases file you must run this:
    # newaliases

    This is all.


    One more thing I am trying to find is how to get the message to my external email address, but also keep a copy of them on that server.

    I found a way by creating new users and then defining redirects to both the new local user and to my external email address, like this:

    postmaster: root, backup_user
    root: you@gmail.com

    But I do not like this method because I have to create a new user for each email redirect.

    If you know a better way, please tell me.

    Thanks.
    Last edited by al_mic; December 19th, 2011 at 07:47 PM. Reason: changed email address

  5. #5
    Join Date
    Sep 2008
    Location
    South Australia
    Beans
    58
    Distro
    Xubuntu 10.10 Maverick Meerkat

    Re: how to get email from /var/spool on an email account

    Ok I edited the aliases file to
    Code:
    postmaster:    root, www-data
    root:   myemailaddress@hotmail.com
    1. Is this correct?
    2. How can I test it to make sure it's working?
    3. If it doesn't work, How do I fix it?


    I set up smartmontools which says it sends error reports for my mdadm to an email address which I specified in the /etc/smartd.conf file but nothing has been sent.
    (\_/) Uber
    (o.o) Xubuntu
    (___)0 Tech!

Bookmarks

Posting Permissions

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