本文整理汇总了PHP中Zend_Mail::getFrom方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Mail::getFrom方法的具体用法?PHP Zend_Mail::getFrom怎么用?PHP Zend_Mail::getFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Mail
的用法示例。
在下文中一共展示了Zend_Mail::getFrom方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendMail
public function sendMail(Zend_Mail $mail, $body, $header)
{
$this->mail = $mail;
$this->body = $body;
$this->header = $header;
$this->recipients = $mail->getRecipients();
$this->subject = $mail->getSubject();
$this->from = $mail->getFrom();
$this->called = true;
}
示例2: sendMessage
/**
* Send a mail using this transport
*
* @return void
* @throws \Magento\Framework\Exception\MailException
*/
public function sendMessage()
{
try {
$sendpulseClient = null;
$recipients = implode(',', $this->_message->getRecipients());
$parameters = array('from' => $this->_message->getFrom(), 'to' => $recipients, 'subject' => quoted_printable_decode($this->_message->getSubject()), 'text' => quoted_printable_decode($this->_message->getBodyText(true)), 'html' => quoted_printable_decode($this->_message->getBodyHtml(true)));
// TODO add attachment support
$attachments = array();
/*
$attachments = array(
'attachment' => array(
'/path/to/file.txt',
'/path/to/file.txt'
)
);
*/
# Make the call to the client.
$result = $sendpulseClient->sendMessage($this->_config->getMailgunDomain(), $parameters, $attachments);
} catch (\Exception $e) {
throw new \Magento\Framework\Exception\MailException(new \Magento\Framework\Phrase($e->getMessage()), $e);
}
}
示例3: sendMessage
/**
* Send a mail using this transport
*
* @return void
* @throws \Magento\Framework\Exception\MailException
*/
public function sendMessage()
{
try {
/** @var Client $client */
$client = new Client();
/** @var $mailgunClient Mailgun */
$mailgunClient = new Mailgun($this->_config->getMailgunKey(), $client);
/** @var string $recipients comma separated */
$recipients = implode(',', $this->_message->getRecipients());
// Assign default parameters
$parameters = array('from' => $this->_message->getFrom(), 'to' => $recipients, 'subject' => $this->decodeZendQuotedPrintableHeader($this->_message->getSubject()), 'text' => quoted_printable_decode($this->_message->getBodyText(true)), 'html' => quoted_printable_decode($this->_message->getBodyHtml(true)));
$parameters = $this->assignOptionalParameters($parameters);
/** @var array $postFiles */
$postFiles = $this->getPostFiles();
$domain = $this->_config->getMailgunDomain();
$result = $mailgunClient->sendMessage($domain, $parameters, $postFiles);
$this->getMail()->setResult($result);
$this->getMail()->setSent($this->createSent())->setSentAt($this->createSentAt())->setTransportId($this->createTransportId());
} catch (\Exception $e) {
throw new \Magento\Framework\Exception\MailException(new \Magento\Framework\Phrase($e->getMessage()), $e);
}
}
示例4: testReturnPath
public function testReturnPath()
{
$mail = new Zend_Mail();
$res = $mail->setBodyText('This is a test.');
$mail->setFrom('testmail@example.com', 'test Mail User');
$mail->setSubject('My Subject');
$mail->addTo('recipient1@example.com');
$mail->addTo('recipient2@example.com');
$mail->addBcc('recipient1_bcc@example.com');
$mail->addBcc('recipient2_bcc@example.com');
$mail->addCc('recipient1_cc@example.com', 'Example no. 1 for cc');
$mail->addCc('recipient2_cc@example.com', 'Example no. 2 for cc');
// First example: from and return-path should be equal
$mock = new Zend_Mail_Transport_Mock();
$mail->send($mock);
$this->assertTrue($mock->called);
$this->assertEquals($mail->getFrom(), $mock->returnPath);
// Second example: from and return-path should not be equal
$mail->setReturnPath('sender2@example.com');
$mock = new Zend_Mail_Transport_Mock();
$mail->send($mock);
$this->assertTrue($mock->called);
$this->assertNotEquals($mail->getFrom(), $mock->returnPath);
$this->assertEquals($mail->getReturnPath(), $mock->returnPath);
$this->assertNotEquals($mock->returnPath, $mock->from);
}
示例5: sendRaw
public function sendRaw(Zend_Mail $mail)
{
if ($this->_enabled) {
try {
$mail->send($this->getTransport());
} catch (Exception $e) {
// Silence? Note: Engine_Exception 's are already logged
if (!$e instanceof Engine_Exception && Zend_Registry::isRegistered('Zend_Log')) {
$log = Zend_Registry::get('Zend_Log');
$log->log($e, Zend_Log::ERR);
}
}
// Logging in dev mode
if ('development' == APPLICATION_ENV) {
$this->getLog()->log(sprintf('[%s] %s <- %s', 'Zend', join(', ', $mail->getRecipients()), $mail->getFrom()), Zend_Log::DEBUG);
}
// Track emails
Engine_Api::_()->getDbtable('statistics', 'core')->increment('core.emails');
}
return $this;
}
示例6: testSettingFromDefaults
public function testSettingFromDefaults()
{
Zend_Mail::setDefaultFrom('john@example.com', 'John Doe');
Zend_Mail::setDefaultReplyTo('foo@example.com', 'Foo Bar');
$mail = new Zend_Mail();
$headers = $mail->setFromToDefaultFrom()->setReplyToFromDefault()->getHeaders();
$this->assertEquals('john@example.com', $mail->getFrom());
$this->assertEquals('foo@example.com', $mail->getReplyTo());
$this->assertEquals('John Doe <john@example.com>', $headers['From'][0]);
$this->assertEquals('Foo Bar <foo@example.com>', $headers['Reply-To'][0]);
}
示例7: sendMail
/**
* send an email
*
* @param Zend_Mail $mail
* @param string $body
* @param string $headers
*/
public function sendMail(Zend_Mail $mail, $body, $headers)
{
$wasConnected = $this->_con !== null;
// check if the connection is already there
if (!$wasConnected) {
$this->connect();
} else {
$this->rset();
}
// if already connected, reset connection
try {
$this->mail_from($mail->getFrom());
foreach ($mail->getRecipients() as $recipient) {
$this->rcpt_to($recipient);
}
$this->data($headers . "\r\n" . $body);
} catch (Zend_Mail_Transport_Exception $e) {
if (!$wasConnected) {
$this->disconnect();
}
// remove connection if we made one
throw $e;
}
if (!$wasConnected) {
$this->disconnect();
}
// remove connection if we made one
}
示例8: array
$message .= "Web-Browser / OS:\n";
$message .= "-------------------------------------------------------\n";
$message .= clean_input($_SERVER["HTTP_USER_AGENT"], array("trim", "emailcontent")) . "\n\n";
$message .= "URL Sent From:\n";
$message .= "-------------------------------------------------------\n";
$message .= (isset($_SERVER["HTTPS"]) ? "https" : "http") . "://" . $_SERVER["HTTP_HOST"] . clean_input($extracted_information["url"], array("trim", "emailcontent")) . "\n\n";
$message .= "=======================================================";
$mail = new Zend_Mail("iso-8859-1");
$mail->addHeader("X-Priority", "3");
$mail->addHeader('Content-Transfer-Encoding', '8bit');
$mail->addHeader("X-Originating-IP", $_SERVER["REMOTE_ADDR"]);
$mail->addHeader("X-Section", "Feedback System");
$mail->addTo($AGENT_CONTACTS["annualreport-support"]["email"], $AGENT_CONTACTS["annualreport-support"]["name"]);
$mail->setFrom($_SESSION["details"]["email"] ? $_SESSION["details"]["email"] : $AGENT_CONTACTS["administrator"]["email"], $_SESSION["details"]["firstname"] . " " . $_SESSION["details"]["lastname"]);
$mail->setSubject("Report Missing /Incorrect Teaching Submission - " . APPLICATION_NAME);
$mail->setReplyTo($mail->getFrom(), $_SESSION["details"]["firstname"] . " " . $_SESSION["details"]["lastname"]);
$mail->setBodyText($message);
try {
$mail->send();
$SUCCESS++;
$SUCCESSSTR[] = "Thank-you for informing us of the missing / incorrect undergraduate teaching. If we have questions regarding any of the information you provided, we will get in touch with you via e-mail, otherwise the teaching will be adjusted within two business days.";
} catch (Zend_Mail_Transport_Exception $e) {
$ERROR++;
$ERRORSTR[] = "We apologize however, we are unable to submit your feedback at this time due to a problem with the mail server.<br /><br />The system administrator has been informed of this error, please try again later.";
application_log("error", "Unable to report missing / incorrect undergraduate teaching with the feedback agent. Zend_mail said: " . $e->getMessage());
}
?>
<div id="wizard-body" style="position: absolute; top: 35px; left: 0px; width: 452px; height: 440px; padding-left: 15px; overflow: auto">
<?php
if ($ERROR) {
echo "<h2>Feedback Submission Failure</h2>\n";