本文整理汇总了PHP中Swift_RecipientList::getCc方法的典型用法代码示例。如果您正苦于以下问题:PHP Swift_RecipientList::getCc方法的具体用法?PHP Swift_RecipientList::getCc怎么用?PHP Swift_RecipientList::getCc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Swift_RecipientList
的用法示例。
在下文中一共展示了Swift_RecipientList::getCc方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
/**
* Send an email to a number of recipients
* Returns the number of successful recipients, or FALSE on failure
* @param mixed The recipients to send to. One of string, array, 2-dimensional array or Swift_Address
* @param mixed The address to send from. string or Swift_Address
* @param string The message subject
* @param string The message body, optional
* @return int
*/
function send($recipients, $from, $subject, $body = null)
{
$this->addTo($recipients);
$sender = false;
if (is_string($from)) {
$sender = $this->stringToAddress($from);
} elseif (is_a($from, "Swift_Address")) {
$sender =& $from;
}
if (!$sender) {
return false;
}
$this->message->setSubject($subject);
if ($body) {
$this->message->setBody($body);
}
$sent = 0;
Swift_Errors::expect($e, "Swift_ConnectionException");
if (!$this->exactCopy && !$this->recipients->getCc() && !$this->recipients->getBcc()) {
$sent = $this->swift->batchSend($this->message, $this->recipients, $sender);
} else {
$sent = $this->swift->send($this->message, $this->recipients, $sender);
}
if (!$e) {
Swift_Errors::clear("Swift_ConnectionException");
if ($this->autoFlush) {
$this->flush();
}
return $sent;
}
$this->setError("Sending failed:<br />" . $e->getMessage());
return false;
}
示例2: send
/**
* Send an email to a number of recipients
* Returns the number of successful recipients, or FALSE on failure
* @param mixed The recipients to send to. One of string, array, 2-dimensional array or Swift_Address
* @param mixed The address to send from. string or Swift_Address
* @param string The message subject
* @param string The message body, optional
* @return int
*/
public function send($recipients, $from, $subject, $body = null)
{
$this->addTo($recipients);
$sender = false;
if (is_string($from)) {
$sender = $this->stringToAddress($from);
} elseif ($from instanceof Swift_Address) {
$sender = $from;
}
if (!$sender) {
return false;
}
$this->message->setSubject($subject);
if ($body) {
$this->message->setBody($body);
}
try {
if (!$this->exactCopy && !$this->recipients->getCc() && !$this->recipients->getBcc()) {
$sent = $this->swift->batchSend($this->message, $this->recipients, $sender);
} else {
$sent = $this->swift->send($this->message, $this->recipients, $sender);
}
if ($this->autoFlush) {
$this->flush();
}
return $sent;
} catch (Swift_ConnectionException $e) {
$this->setError("Sending failed:<br />" . $e->getMessage());
return false;
}
}
示例3: testDuplicateEntriesInSameFieldAreOverWritten
/**
* Test that only no duplicates can exist.
*/
public function testDuplicateEntriesInSameFieldAreOverWritten()
{
$list = new Swift_RecipientList();
$list->addCc(new Swift_Address("foo@bar.com"));
$list->addCc("joe@bloggs.com", "Joe");
$list->addCc("jim@somewhere.co.uk");
$list->addCc("foo@bar.com", "Foo");
$this->assertEqual(3, count($list->getCc()));
}