Hello! walt wrote:
>"Keith Burke [Experience IT]" wrote: > > > >>Greetings, >> >> I'm new to this list but not to MySQL. I've been using MySQL on >>Linux with PHP for the past year or two. I've always managed to sort out >>any problems by looking at the documentation on the website but my >>current problem has me perplexed. >> >> I need to be able to send Emails to people from MySQL command >>line. >> >> I'm importing a text file of users via a cronjob. MySQL process >>the data and segragates it into different tables. My problem is that I >>want MySQL to Email the plain text passwords to the users before it >>MD5's them. I cannot find any references that MySQL can run external >>programs [sendmail]. >> >> You do it with a cronjob, so why not using some of the nice Unix commands on the file before importing it. I use bash or awk for such things...maybe like this (Assuming your file (the_file) looks like this: <USERNAME> <PASSWORD> ... Write an awk script, like this (mailsend) ######################### #!/bin/awk -f { message( $1, $2 ) } function message( uid, pwd ) { print "Dear " uid "!" >"/tmp/mail.txt"; print "" >"/tmp/mail.txt"; print "Your username is:" uid >"/tmp/mail.txt"; print "Your password is:" pwd >"/tmp/mail.txt"; print "" >"/tmp/mail.txt"; print "Be aware that your password will be saved in an encrypted format, so noone can read it!" >"/tmp/mail.txt"; close( "/tmp/mail.txt"); cmd = "cat /tmp/mail.txt | mail -s 'Your password for xyz' " uid "@somewhere.com"; system(cmd); } ######################### chmod mailsend 700 mailsend the_file (BTW: in the above example might be syntax error, because I did not test it ;-) ) Greetings Ralf -- Ralf Narozny Besuchen Sie uns auf der DMS-Expo. SAP, Dokumenten- management oder das komplette Office ins Portal einbinden? Wir zeigen es Ihnen - vom 3. bis 5.9. auf der Messe Essen Halle 3, Stand 3255 SPLENDID Internet GmbH & Co KG Skandinaviendamm 212, 24109 Kiel, Germany fon: +49 431 660 97 0, fax: +49 431 660 97 20 mailto:[EMAIL PROTECTED], http://www.splendid.de --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <mysql-unsubscribe-##L=##[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php