1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | sub Mail_Mailer { my $destination_directory ='/data/'; my $from_address = "abc@gmail.com"; my $to_address = "abc@gmail.com"; my $subject = "SOFT DATA "; my $body = "Dear Sir\nPlease find the complete set of data on sftp\n."; my $cc="test@gmail.com"; opendir (DES,$destination_directory); my @files=readdir(DES); close(DES); my @mail_sent_file=@file; foreach my $mail_file_names (@mail_sent_file) { $body=${body}."\n".$mail_file_names."\n"; } $body=${body}."\nRegards\nreportsadmin."; my $mailer = Mail::Mailer->new("sendmail") or die; $mailer->open( { From => $from_address, To => $to_address, Cc => $cc, Bcc => $bcc, Subject => $subject, } ); print "Going to send the mail."; print $mailer $body; $mailer->close(); print "Mail sent."; return ($mailer); } |
Change MySQL user's password in bulk Sometimes we need to change the password of mysql users at bulk. Lets say your company has fired a group of peoples or dissolved a project. This requirement can be supplied as : We can achieve the same by changing the password field in mysql.user table. Password() is a predifined method in mysql which generates encrypted value of a certain string. host update mysql.user set password = PASSWORD("passwd") where host IN (<Comma separated list of HostName/IP>); user update mysql.user set password = PASSWORD("passwd") where user IN (<Comma separated list of ‘user’@’host’>);
Comments
Post a Comment