One thing to think about here is whether e-mailing these logins in the clear is actually the best way to distribute usernames and passwords to your users. Depending on your setup, there are likely to be various points at which someone could potentially sniff these messages in clear text as they're passing by, and thusly obtain your users' credentials.
However, if you are set on doing things this way, here's a solution.
Firstly, I've made a slight change to the format of letter.txt, so that it now looks like this:
So I'm using _USERNAME_ and _PASSWORD_ as placeholders here for what will be the real login details, as we'll see in a bit.
As for your maillist.txt, that's basically the same:
So the first field is the username to be e-mailed, the second is the password to be e-mailed, and the third is the e-mail address to which the details should be sent.
Lastly, here's the actual script itself:
So the idea is that we read in each line of maillist.txt, break out the username, password and e-mail address, do a search-and-replace in letter.txt to swap out the underscore-bracketed placeholders for the real details, then we e-mail them to the address on file.
You CAN use $1 and $2 in your files when taking preventive measures, but it normally is not wise to use reserved words or similar. Slightly adapting drysdalk's proposal, try:
I have a file 1.txt which has 3 mail ids as below:
Maillist=abc@gmail.com def@gmail.com rcg@gmail.com
Now I want to write a script which will read this file and send the mail to all the users present in this file. (6 Replies)
Dear all,
The perl script to send e-mail is working in my current script.
#This part of the script will send the email notification
my $to='mohamed.rahman@noridian.com';
my $from='xyz@hotmail.com';
my $subject='POS_CODES_38 DATA LOADED SUCCESSFULLY.';
my $message='The total no. of files... (2 Replies)
Hi all,
This is my first post.
I am new to unix scripting.
My requirement is as follows :
We are using a financial backoffice application.
Now at the end of day we have send users a status report stating all timings of EOD processes for all countries.
I need timings for following... (0 Replies)
currently, my samba login works just fine. i want my clients to use aix5.3 account to login to samba so they don't have to change samba pwd and aix pwd. i googled, and vi /usr/lib/smb.conf per some of knowledge base, but i could not get to work.
aix5.3 and samba 3.0.24.0
thanks in advace..... (2 Replies)
Dear Forum,
I had this case before, all of sudden all users including root can't login. What done is by connecting to console port and resetting root password, "pwunconv" command, reboot server.
My question is, how this can happen???
thanks
:confused: (3 Replies)
Hello everyone
I need to send to a file the last command from all users who log in and log out by week or month.
My questions are
I can do it with the command or I need to do a script ?
If the answer is I need to do a script, someone can help me because Im complete new to make a... (3 Replies)
hi,
i'm pretty new to this unix. i've been asked to create a shell script which will pick up the email id from a text file(stored in same machine, same directory) searches for that id in another file in which a product name( a one line text) is mentioned against it. then it should send a mail... (0 Replies)
Hi.
I need the name for one command which I cant remember. This command displays all users which can log in to the system, wether they are stored in /etc/passwd, NIS og LDAP. Does anyone remember what command this is? (2 Replies)
Hi,
If I want to send an email to serveral users, what is the correct way to do it?
I know a little bit mail command. If I want to send email to John and Scott after UNIX shell scripts have completed the job. I type:
mail -s 'Job has been completed successfully' john@yahoo.com < log.txt
... (4 Replies)