本文整理汇总了PHP中UserPeer::getUserFromEmailLocalPart方法的典型用法代码示例。如果您正苦于以下问题:PHP UserPeer::getUserFromEmailLocalPart方法的具体用法?PHP UserPeer::getUserFromEmailLocalPart怎么用?PHP UserPeer::getUserFromEmailLocalPart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserPeer
的用法示例。
在下文中一共展示了UserPeer::getUserFromEmailLocalPart方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
protected function execute($arguments = array(), $options = array())
{
// initialize the database connection
$databaseManager = new sfDatabaseManager($this->configuration);
$connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
$to = $arguments['to'] ? $arguments['to'] : '';
$message2 = $arguments['message'] ? $arguments['message'] : '';
// TODO : get login, localparts names
$subject = "Welcome to JU email System";
$headers = 'From: Jimma University ICTDO <support@ju.edu.et>';
$message = <<<EOF
Hello #FIRSTNAME# #FATHERSNAME#,
We would like to inform you about the following.
Your login name for the User Adminitration System is: #LOGIN#
Please go to http://mail.ju.edu.et/uas/ to use it. The password to log in
is the same as for the email system.
Login in into the email system is still done with your email address.
Thank you for your cooperation. We hope you will enjoy the UAS.
Expect us to expand its functionality in the future.
The ICT Development office
EOF;
$users = array();
if ($to != '') {
$a = explode("@", $to);
$users[] = UserPeer::getUserFromEmailLocalPart($a[0]);
} else {
$users = UserPeer::getEmailAccounts();
}
if ($message2 != '') {
$handle = fopen($message2, 'r');
$Data = fread($handle, filesize($message2));
fclose($handle);
//echo $Data;
} else {
echo "You must provide file that has text";
}
foreach ($users as $user) {
$login = $user->getLogin();
$search = array("#LOGIN#", "#FIRSTNAME#", "#FATHERSNAME#", "#EMAILADDRESS#");
$replace = array($user->getLogin(), $user->getName(), $user->getFathersName(), $user->getEmailAddress());
echo str_replace($search, $replace, $Data);
/*if(!mail($user->getEmailAddress(), $subject, str_replace($search, $replace, $Data), $headers))
{
echo "message failed";
}*/
}
//echo $message2;
}