You are here: Re: variables from bash to phpmailer « PHP Language « IT news, forums, messages
Re: variables from bash to phpmailer

Posted by Janwillem Borleffs on 12/23/05 17:32

Dave Kelly wrote:
> I'm new to php and haven't got a clue what I'm doing.
> I need to pass a variable from a bash script to a phpmailer function.
>
[...]
> Here is the error message I get when the program aborts.
>
> daveekelly@earthlink.net is admin
> --just before the php code
> Message was not sentMailer Error: Language string failed to load:
> recipients_failed
>
>
> Here is the code that calls the php code.
>

Here's a bash script showing the basics:

#!/usr/bin/bash

function mailsender {
recepient=$1
php -r "echo '$recepient';"
}

admin_mail=$1
mailsender $admin_mail

Note the use of double/single quotes within the mailsender function.

Also note that you do not need to use bash for this, but also pure php:

test.php:

<?php
if (isset($_SERVER['argv'][1])) {
echo "Hello {$_SERVER['argv'][1]}";
} else {
echo "Hello Unknown";
}
?>

Call: $ php -f test.php John

For more info, see: http://www.php.net/features.commandline


JW

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация