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); } |
Start mysql in Ubuntu without having root privilege:- If you want to use mysql in Ubutu you can use following command which will use a root level privilege $ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 147 Server version: 5.1.49-1ubuntu8.1-log (Ubuntu) When it demands to enter the password fill it with 'root' and hopefully you'll get logged in . Last_insert_id():- (with no argument) returns the first automatically generated value that was set for an AUTO_INCREMENT column by the most recently executed INSERT statement to affect such a column. For example, after inserting a row that generates an AUTO_INCREMENT value, you can get the value like this: mysql> SELECT LAST_INSERT_ID(); Database():- Database() method returns the current selected database and you can use it in your communication and your queries. The syntax is : mysql>select Database (); User():- It a...
Comments
Post a Comment