General
cancel
Showing results for 
Search instead for 
Did you mean: 

Using /etc/aliases to auto print email

Rick Knisely
Occasional Advisor

Using /etc/aliases to auto print email

I am using the following entry in /etc/aliases to automatically print every email that is sent to a specific userID:

:\, "| lp -d "

I cannot get it to print. What am I missing? I have restated sendmail after making any changes to aliases.
Don't Sweat the Small Stuff!
10 REPLIES
Jeff Schussele
Honored Contributor

Re: Using /etc/aliases to auto print email

Hi Rick,

There must be NO space between the -d & the printer_name - EX:

lp -dprinter1

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Jeff Schussele
Honored Contributor

Re: Using /etc/aliases to auto print email

Oh & it may not know *where* the lp command is - so try

"|/usr/bin/lp -d"

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Rick Knisely
Occasional Advisor

Re: Using /etc/aliases to auto print email

I have modified the line to now read:

:\"

I get the email correctly in mailbox, but it still "will not" print.

Thanks!
Don't Sweat the Small Stuff!
Jeff Schussele
Honored Contributor

Re: Using /etc/aliases to auto print email

Did you rebuild the aliases DB with the
newaliases
or
sendmail -bi
commands?
Has to be done for *every* change to the aliases files.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Rick Knisely
Occasional Advisor

Re: Using /etc/aliases to auto print email

Yes, I have run sendmail -bi following each modification to /etc/aliases. Line reads as follows:

# Local aliases
:\,"/usr/bin/lp -d"

I get the mail in mail box and can even manually print using print command in elm or mail. But it will not print from aliases?

Any other thoughts?

Thanks for you help
Don't Sweat the Small Stuff!
Rick Knisely
Occasional Advisor

Re: Using /etc/aliases to auto print email

Yes, I have run sendmail -bi following each modification to /etc/aliases. Line reads as follows:

# Local aliases
:\,"|/usr/bin/lp -d"

I get the mail in mail box and can even manually print using print command in elm or mail. But it will not print from aliases?

Any other thoughts?

Thanks for you help
Don't Sweat the Small Stuff!
Jeff Schussele
Honored Contributor

Re: Using /etc/aliases to auto print email

Hi (again) Rick,

Well....I think you need whitespace in the line around the colon - try

username : \username,"|/usr/bin/lp -dprinter1"

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Rick Knisely
Occasional Advisor

Re: Using /etc/aliases to auto print email

The whitespace was added, and sendmail -bi run. It is still not printing email.
Don't Sweat the Small Stuff!
Jeff Schussele
Honored Contributor

Re: Using /etc/aliases to auto print email

OK, well it's time to punt then.
Set up a .forward file in that user's home dir & make sure the user owns it.

Then in it put what would be on the right side of the aliases file for that user & make sure you remove the user from the aliases file.

Then try.

BTW - Is there anything in the lp logs about these print jobs? Do they even make it to the spooler?

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Berlene Herren
Honored Contributor

Re: Using /etc/aliases to auto print email

Hi Rick,
I was able make this work...

1. added user bherren

2. In /etc/mail/aliases

# Local aliases

bherren :"|/usr/bin/lp -d16_1"

3. sendmail -bi

4. sendmail -v bherren
test to the printer
.

"|/usr/bin/lp -d16_1"... Connecting to prog...
"|/usr/bin/lp -d16_1"... Sent

5. #mtail
Sep 16 15:55:30 seminole sendmail[29398]: PAA29398: to="|/usr/bin/lp -d16_1", delay=00:00:08, xdelay=00:00:00, mailer=prog, stat=Sent

6. Printed out "test to printer"

Berlene
http://www.mindspring.com/~bkherren/dobes/index.htm