本文整理汇总了PHP中Mailer::mailFromUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Mailer::mailFromUser方法的具体用法?PHP Mailer::mailFromUser怎么用?PHP Mailer::mailFromUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mailer
的用法示例。
在下文中一共展示了Mailer::mailFromUser方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendSummary
function sendSummary()
{
$userMail = Mailer::mailFromUser('mail');
if (!$userMail) {
return false;
}
$userMail = stripslashes($userMail);
$mailText = 'Hallo,' . "\n" . 'hier eine Zusammenfassung aller Bücher, die mit deiner E-Mailadresse angeboten werden.';
$books = new UsersBooks($userMail);
$mailText .= $books->toString();
return Mailer::mail($userMail, 'Deine Angebote', $mailText);
}
示例2: testMailFromUser
function testMailFromUser()
{
$index = 'mail';
$_POST[$index] = 'juser';
$result = Mailer::mailFromUser($index);
$this->assertNotNull($result, 'Simple name not accepted.');
unset($_POST[$index]);
$_GET[$index] = 'juser';
$result = Mailer::mailFromUser($index);
$this->assertNotNull($result, 'From $_GET array not accepted.');
$_POST[$index] = 'juser1';
$result = Mailer::mailFromUser($index);
$this->assertNotNull($result, "Number not accepted.");
$_POST[$index] = 'juser1@example.com';
$result = Mailer::mailFromUser($index);
$this->assertNotNull($result, "Domain not accepted.");
$_POST[$index] = "mail@example.com\nTo: spam@example.com";
$result = Mailer::mailFromUser($index);
$this->assertNull($result, 'new line accepted');
}
示例3: sendMailIfRequested
/**
* Checks POST data and sends E-Mail, if everything is correct.
* @return bool true, if mail variable doesn't contain an @.
*/
public function sendMailIfRequested()
{
/*
* $_POST['name'] should contain a mail address.
* It is named 'name' to trick robots.
*/
if (!isset($_POST['name'])) {
return false;
}
$user_mail = stripslashes(Mailer::mailFromUser('name'));
if (!strstr($user_mail, '@')) {
return true;
}
require_once 'tools/Mailer.php';
$subject = 'Anfrage: ';
$message = 'Es hat jemand mit der E-Mailadresse "' . $user_mail . '" Interesse für das unten stehende Buch bekundet.';
if (isset($_POST['user_text']) && $_POST['user_text']) {
$message .= ' Folgende Nachricht wurde mitgesandt:' . "\n\n";
$message .= stripslashes($_POST['user_text']) . "\n";
}
$booked = Mailer::send($this->bookId, $subject, $message, $user_mail);
header('Location: book.php?id=' . $this->bookId . '&booked=' . $booked);
exit;
}
示例4: import_book
function import_book($bookString, Template $tmpl)
{
$labels = array('Autor', 'Titel', 'Preis', 'Erscheinungsjahr', 'ISBN', 'Beschreibung');
$indices = array('author', 'title', 'price', 'year', 'isbn', 'description');
$bookString = trim($bookString);
$bookLines = split("\n", $bookString, sizeof($labels));
for ($i = 0; $i < sizeof($labels); $i++) {
list($label, $value) = split(':', $bookLines[$i], 2);
if (trim($label) != $labels[$i]) {
$value = '';
}
$value = Parser::text2html(stripslashes(trim($value)));
$tmpl->assign($indices[$i], $value);
}
}
$usermail = Parser::text2html(stripslashes(Mailer::mailFromUser('mail')));
if (isset($_POST['book_data'])) {
$tmpl = Template::fromFile('view/add_form.html');
import_book($_POST['book_data'], $tmpl);
if (isset($_POST['mail'])) {
$tmpl->assign('mail', $usermail);
}
$selectableCategories = new SelectableCategories();
$categoryString = implode(' ', $selectableCategories->createSelectArray());
$tmpl->assign('categories', $categoryString);
} else {
$tmpl = Template::fromFile('view/import.html');
if (isset($_GET['mail'])) {
$mailTmpl = $tmpl->addSubtemplate('mail');
$mailTmpl->assign('mail', $usermail);
}
示例5: getMail
private function getMail()
{
if ($this->mail === null) {
$this->mail = Mailer::mailFromUser('author');
}
return $this->mail;
}
示例6: SearchKey
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
require_once 'books/SearchKey.php';
require_once 'notification/Searches.php';
require_once 'tools/Mailer.php';
$searchKey = new SearchKey();
if (!$searchKey->isGiven()) {
header('Location: ./');
}
$mail = Mailer::mailFromUser('mail');
if ($mail == null) {
$mail = Mailer::mailFromUser('name');
}
if ($mail) {
$searches = new Searches();
$searches->addSearch($searchKey->asText(), $mail);
header('Location: ./?search=' . urlencode($searchKey->asText()) . '&searchSaved=1');
}
$tmpl = Template::fromFile("view/save_search.html");
$tmpl->assign('searchKey', $searchKey->asHtml());
$tmpl->assign('urlSearchKey', urlencode($searchKey->asHtml()));
$output = new Output();
$output->send($tmpl->result());