send email automatically to new user

Ryan Golhar golharam at umdnj.edu
Fri Jun 18 16:51:17 UTC 2004


Sure.  Here's what I did:

1.  Store the user's account name in $username
2.  Store the email in $email
3:

# send email using rmail
# By calling open on the magic character sequence |-, you fork a copy
# of Perl and open a pipe to the copy.  The child copy then immediately
# exec's another program using the argument list variant of exec().
open(RMAIL,"|-") || exec "/usr/bin/rmail", "$username\@umdnj.edu";
print RMAIL $email,"\n";
close RMAIL;


-----
Ryan Golhar
Computational Biologist
The Informatics Institute at
The University of Medicine & Dentistry of NJ

Phone: 973-972-5034
Fax: 973-972-7412
Email: golharam at umdnj.edu

-----Original Message-----
From: redhat-list-bounces at redhat.com
[mailto:redhat-list-bounces at redhat.com] On Behalf Of Robert Canary
Sent: Friday, June 18, 2004 12:42 PM
To: General Red Hat Linux discussion list
Subject: Re: send email automatically to new user


Our "useradd" is actually a perl script that dose 
everything we want it to do *and* runs the 
originally useradd....well it use to.  Actually it 
is all been replaced with the perl script.

Nabin Limbu wrote:
> Hi,
> 
> Is there any way to send a standard email to a new user automatically 
> while creating a
> user via useradd command.
> 
> Regards
> Nabin Limbu
> 
> 


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list





More information about the redhat-list mailing list