本文整理汇总了PHP中imap_mail函数的典型用法代码示例。如果您正苦于以下问题:PHP imap_mail函数的具体用法?PHP imap_mail怎么用?PHP imap_mail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了imap_mail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _sendSummaryEmail
function _sendSummaryEmail()
{
if (count($this->_getMsgIDs()) < 1) {
$this->_addToSummary('No ARB emails to process');
return;
}
$summary = $this->_summaryToString();
$envelope["from"] = ini_get('sendmail_from');
$body[] = array("type" => TYPEMULTIPART, "subtype" => "mixed");
$body[] = array('type' => 0, 'encoding' => 0, 'subtype' => "PLAIN", 'contents.data' => $summary);
foreach ($this->_getAttachments() as $filename => $attachment) {
$body[] = array('type' => 0, 'encoding' => 0, 'subtype' => "X-COMMA-SEPARATED-VALUES", 'description' => $filename, 'disposition.type' => 'attachment', 'disposition' => array('filename' => $filename), 'dparameters.filename' => $filename, 'parameters.name' => $filename, 'contents.data' => $attachment);
}
$msg = imap_mail_compose($envelope, $body);
list($t_header, $t_body) = split("\r\n\r\n", $msg, 2);
$t_header = str_replace("\r", '', $t_header);
$success = imap_mail(_CRM_PROCESS_AUTHORIZE_REPORT_SUMMARY_TO_EMAIL, 'Authorize.net Report Processesing Summary', $t_body, $t_header);
}
示例2: SendMail
//.........这里部分代码省略.........
$attname = $part->headers['content-description'];
} else {
$attname = "unknown attachment";
}
}
}
// ignore html content
if ($part->ctype_primary == "text" && $part->ctype_secondary == "html") {
continue;
}
//
if ($use_orgbody || $attached) {
$body .= $this->enc_attach_file($att_boundary, $attname, strlen($part->body), $part->body, $part->ctype_primary . "/" . $part->ctype_secondary);
} else {
$encmail = $body;
$attached = true;
$body = $this->enc_multipart($att_boundary, $body, $forward_h_ct, $forward_h_cte);
$body .= $this->enc_attach_file($att_boundary, $attname, strlen($part->body), $part->body, $part->ctype_primary . "/" . $part->ctype_secondary);
}
}
}
$body .= "--{$att_boundary}--\n\n";
}
unset($mobj2);
}
// unset origmail - free memory
unset($origmail);
}
// remove carriage-returns from body
$body = str_replace("\r\n", "\n", $body);
//advanced debugging
//debugLog("IMAP-SendMail: parsed message: ". print_r($message,1));
debugLog("IMAP-SendMail: headers: {$headers}");
debugLog("IMAP-SendMail: subject: {$message->headers["subject"]}");
debugLog("IMAP-SendMail: body: {$body}");
//
if (!defined('IMAP_USE_IMAPMAIL') || IMAP_USE_IMAPMAIL == true) {
$send = @imap_mail($toaddr, !isset($message->headers["subject"]) ? "" : $message->headers["subject"], $body, $headers, $ccaddr, $bccaddr);
} else {
if (!empty($ccaddr)) {
$headers .= "\nCc: {$ccaddr}";
}
if (defined('INTERNAL_SMTPCLIENT_SERVERNAME') && INTERNAL_SMTPCLIENT_SERVERNAME != '') {
$headers .= "\nSubject: " . (!isset($message->headers["subject"]) ? "" : $message->headers["subject"]);
$headers .= "\nTo: " . (!isset($message->headers["to"]) ? "" : $message->headers["to"]);
$send = @InternalSMTPClient($fromaddr, !isset($message->headers["to"]) ? "" : $message->headers["to"], !isset($message->headers["cc"]) ? "" : $message->headers["cc"], !isset($message->headers["bcc"]) ? "" : $message->headers["bcc"], $headers . "\n" . $body);
} else {
if (!empty($bccaddr)) {
$headers .= "\nBcc: {$bccaddr}";
}
$send = @mail($toaddr, !isset($message->headers["subject"]) ? "" : $message->headers["subject"], $body, $headers, $envelopefrom);
}
}
// email sent?
if (!$send) {
debugLog("The email could not be sent. Last-IMAP-error: " . imap_last_error());
return 120;
}
// add message to the sent folder
// build complete headers
$headers .= "\nTo: {$toaddr}";
$headers .= "\nSubject: " . $message->headers["subject"];
if (!defined('IMAP_USE_IMAPMAIL') || IMAP_USE_IMAPMAIL == true) {
if (!empty($ccaddr)) {
$headers .= "\nCc: {$ccaddr}";
}
if (!empty($bccaddr)) {
$headers .= "\nBcc: {$bccaddr}";
}
}
//debugLog("IMAP-SendMail: complete headers: $headers");
$asf = false;
if ($this->_sentID) {
$asf = $this->addSentMessage($this->_sentID, $headers, $body);
} else {
if (defined('IMAP_SENTFOLDER') && IMAP_SENTFOLDER) {
$asf = $this->addSentMessage(IMAP_SENTFOLDER, $headers, $body);
debugLog("IMAP-SendMail: Outgoing mail saved in configured 'Sent' folder '" . IMAP_SENTFOLDER . "': " . ($asf ? "success" : "failed"));
} else {
debugLog("IMAP-SendMail: No Sent mailbox set");
if ($this->addSentMessage("INBOX.Sent", $headers, $body)) {
debugLog("IMAP-SendMail: Outgoing mail saved in 'INBOX.Sent'");
$asf = true;
} else {
if ($this->addSentMessage("Sent", $headers, $body)) {
debugLog("IMAP-SendMail: Outgoing mail saved in 'Sent'");
$asf = true;
} else {
if ($this->addSentMessage("Sent Items", $headers, $body)) {
debugLog("IMAP-SendMail: Outgoing mail saved in 'Sent Items'");
$asf = true;
}
}
}
}
}
// unset mimedecoder - free memory
unset($mobj);
return $send && $asf;
}
示例3: send
public function send($to, $subject, $message, $headers = NULL, $settings = NULL)
{
return imap_mail($to, $subject, $message, $headers);
}
示例4: sendMail
/**
* @brief Methode Simple d'envoi mail
* @details Methode simplissime
*
* @param to Mail du destinataire
* @param subject String Objet de mon mail
* @param message String Message a envoyer
*
* @return bool True si succes false sinon
*
*/
public function sendMail($to, $subject, $message)
{
$status = imap_mail($to, $subject, $message);
return $status;
}
示例5: sendMessage
/**
* !Broken
*
* @param array $reciever
* @param $subject
* @param $message
* @return bool
*/
private function sendMessage(array $reciever, $subject, $message)
{
$header = new MessageHeader($reciever['bcc'], $reciever['cc'], Carbon\Carbon::now()->toDateTimeString(), $this->email, $subject, $reciever['to']);
$body = new MessageBody($message);
$message = imap_mail_compose($header->toArray(), array($body->toArray()));
return imap_mail($header->to, $header->subject, $message);
}
示例6: send
/**
* @param string $subject
* @param string $error
*/
public function send($subject, $error)
{
imap_mail($subject, $error);
}
示例7: sendTicketReassignment
function sendTicketReassignment($toEmail, $subjectl)
{
$subject = "Ticket Assigned";
$body = "Collaborative Platform has assigned you a new ticket " . $subjectl . "that was previously assigned to another mentor.\n Thank you for Making Collaborative Platform Great";
$headers = "From: fiucoplat@cp-dev.cs.fiu.edu\r\n" . "Reply-To: fiucoplat@cp-dev.cs.fiu.edu\r\n";
$cc = null;
$bcc = null;
$return_path = "fiucoplat@cp-dev.cs.fiu.edu";
//send the email using IMAP
$a = imap_mail($toEmail, $subject, $body, $headers, $cc, $bcc, $return_path);
echo "Email sent!<br />";
}
示例8: SendMail
function SendMail($rfc822, $forward = false, $reply = false, $parent = false)
{
debugLog("IMAP-SendMail: " . $rfc822 . "for: {$forward} reply: {$reply} parent: {$parent}");
$mobj = new Mail_mimeDecode($rfc822);
$message = $mobj->decode(array('decode_headers' => true, 'decode_bodies' => true, 'include_bodies' => true, 'input' => $rfc822, 'crlf' => "\n", 'charset' => 'utf-8'));
$toaddr = $ccaddr = $bccaddr = "";
if (isset($message->headers["to"])) {
$toaddr = $this->parseAddr(Mail_RFC822::parseAddressList($message->headers["to"]));
}
if (isset($message->headers["cc"])) {
$ccaddr = $this->parseAddr(Mail_RFC822::parseAddressList($message->headers["cc"]));
}
if (isset($message->headers["bcc"])) {
$bccaddr = $this->parseAddr(Mail_RFC822::parseAddressList($message->headers["bcc"]));
}
// save some headers when forwarding mails (content type & transfer-encoding)
$headers = "";
$forward_h_ct = "";
$forward_h_cte = "";
$use_orgbody = false;
// clean up the transmitted headers
// remove default headers because we are using imap_mail
$changedfrom = false;
foreach ($message->headers as $k => $v) {
if ($k == "subject" || $k == "to" || $k == "cc" || $k == "bcc") {
continue;
}
// save the original type & encoding headers for the body part
if ($forward && $k == "content-type") {
$forward_h_ct = $v;
continue;
}
if ($forward && $k == "content-transfer-encoding") {
$forward_h_cte = $v;
}
// if the message is a multipart message, then we should use the sent body
if (!$forward && $k == "content-type" && preg_match("/multipart/i", $v)) {
$use_orgbody = true;
}
// check if "from"-header is set
if ($k == "from" && !empty($this->_config['IMAP_FORCEFROM'])) {
$changedfrom = true;
$v = $this->_config['IMAP_FORCEFROM'];
$v = str_replace('%u', $this->_username, $v);
$v = str_replace('%d', $this->_domain, $v);
}
// all other headers stay
if ($headers) {
$headers .= "\n";
}
$headers .= ucfirst($k) . ": " . $v;
}
if (!empty($this->_config['IMAP_FORCEFROM']) && !$changedfrom) {
$v = $this->_config['IMAP_FORCEFROM'];
$v = str_replace('%u', $this->_username, $v);
$v = str_replace('%d', $this->_domain, $v);
if ($headers) {
$headers .= "\n";
}
$headers .= 'From: ' . $v;
}
// if this is a multipart message with a boundary, we must use the original body
if ($use_orgbody) {
list(, $body) = $mobj->_splitBodyHeader($rfc822);
} else {
$body = $this->getBody($message);
}
// reply
if (isset($reply) && isset($parent) && $reply && $parent) {
$this->imap_reopenFolder($parent);
$origmail = @imap_body($this->_mbox, $reply, FT_PEEK | FT_UID);
$mobj2 = new Mail_mimeDecode($origmail);
// receive only body
$body .= $this->getBody($mobj2->decode(array('decode_headers' => true, 'decode_bodies' => true, 'include_bodies' => true, 'input' => $origmail, 'crlf' => "\n", 'charset' => 'utf-8')));
}
// forward
if (isset($forward) && isset($parent) && $forward && $parent) {
$this->imap_reopenFolder($parent);
// receive entire mail (header + body)
$origmail = @imap_fetchheader($this->_mbox, $forward, FT_PREFETCHTEXT | FT_UID) . @imap_body($this->_mbox, $forward, FT_PEEK | FT_UID);
// build a new mime message, forward entire old mail as file
list($aheader, $body) = $this->mail_attach("forwarded_message.eml", strlen($origmail), $origmail, $body, $forward_h_ct, $forward_h_cte);
// add boundary headers
$headers .= "\n" . $aheader;
}
//advanced debugging
//debugLog("IMAP-SendMail: headers: $headers");
//debugLog("IMAP-SendMail: body: $body");
$send = @imap_mail($toaddr, $message->headers["subject"], $body, $headers, $ccaddr, $bccaddr);
// add message to the sent folder
// build complete headers
$cheaders = "To: " . $toaddr . "\n";
$cheaders .= "Subject: " . $message->headers["subject"] . "\n";
$cheaders .= "Cc: " . $ccaddr . "\n";
$cheaders .= $headers;
$asf = false;
if ($this->_sentID) {
$asf = $this->addSentMessage($this->_sentID, $cheaders, $body);
} else {
debugLog("IMAP-SendMail: No Sent mailbox set");
//.........这里部分代码省略.........
示例9: sendMessage
public function sendMessage($to, $subject, $message)
{
return imap_mail($to, $subject, $message);
}
示例10: imap_fetch_overview
/* get information specific to this email */
$Data[$IX] = (array) imap_fetch_overview($Call['Link'], $Number, 0)[0];
$Data[$IX]['message'] = base64_decode(imap_fetchbody($Call['Link'], $Number, 2));
$IX++;
}
} else {
$Data = null;
}
return $Data;
});
setFn('Write', function ($Call) {
$Headers['from'] = $Call['From'];
$Headers['subject'] = $Call['ID'];
$Headers['date'] = date(DATE_RFC2822);
$HTML = [];
$Plain = [];
$HTML['type'] = TYPETEXT;
$HTML['charset'] = 'utf-8';
$HTML['subtype'] = 'html';
$HTML['description'] = '';
$HTML['contents.data'] = $Call['Data'];
$Plain['type'] = TYPETEXT;
$Plain['charset'] = 'utf-8';
$Plain['subtype'] = 'plain';
$Plain['description'] = '';
$Plain['contents.data'] = strip_tags($Call['Data']);
$Body = [['type' => TYPEMULTIPART, 'subtype' => 'alternative'], $HTML, $Plain];
$Envelope = str_replace("\r", '', imap_mail_compose($Headers, $Body));
imap_mail($Call['Scope'], $Call['ID'], $Envelope);
return $Call['Data'];
});
示例11: sha1
$e = sha1($email);
$to = trim($email);
$subject = "[Marktplatz.cc] Request to Reset Your Password";
$headers = "From: Marktplatz.cc <donotreply@marktplatz.cc> Content-Type: text/plain";
$msg = <<<EMAIL
We just heard you forgot your password! Bummer! To get going again,
head over to the link below and choose a new password.
Follow this link to reset your password:
http://www.vollrot.de/marktplatz/resetpassword.php?v=$ver&e=$e
If you have any questions, please contact info@coloredlists.com.
--
Thanks!
EMAIL;
mail($to, $subject, "blabla", $headers);
echo $headers." => ".$to;
*/
// Die Nachricht
$nachricht = "blablabla";
// Send
mail('mail@sebastian-engel.de', 'Mein Betreff', $nachricht);
imap_mail('mail@sebastian-engel.de', 'Mein Betreff', $nachricht);
示例12: SendMail
function SendMail($rfc822, $forward = false, $reply = false, $parent = false)
{
debugLog("IMAP-SendMail: " . $rfc822 . "for: {$forward} reply: {$reply} parent: {$parent}");
$mobj = new Mail_mimeDecode($rfc822);
$message = $mobj->decode(array('decode_headers' => true, 'decode_bodies' => true, 'include_bodies' => true, 'input' => $rfc822, 'crlf' => "\n", 'charset' => 'utf-8'));
$toaddr = $ccaddr = $bccaddr = "";
if (isset($message->headers["to"])) {
$toaddr = $this->parseAddr(Mail_RFC822::parseAddressList($message->headers["to"]));
}
if (isset($message->headers["cc"])) {
$ccaddr = $this->parseAddr(Mail_RFC822::parseAddressList($message->headers["cc"]));
}
if (isset($message->headers["bcc"])) {
$bccaddr = $this->parseAddr(Mail_RFC822::parseAddressList($message->headers["bcc"]));
}
// save some headers when forwarding mails (content type & transfer-encoding)
$headers = "";
$forward_h_ct = "";
$forward_h_cte = "";
// clean up the transmitted headers
// remove default headers because we are using imap_mail
foreach ($message->headers as $k => $v) {
if ($k == "subject" || $k == "to" || $k == "cc" || $k == "bcc") {
continue;
}
// save the original type & encoding headers for the body part
if ($forward && $k == "content-type") {
$forward_h_ct = $v;
continue;
}
if ($forward && $k == "content-transfer-encoding") {
$forward_h_cte = $v;
}
// all other headers stay
if ($headers) {
$headers .= "\n";
}
$headers .= ucfirst($k) . ":" . $v;
}
$body = $this->getBody($message);
// reply
if (isset($reply) && isset($parent) && $reply && $parent) {
$this->imap_reopenFolder($parent);
$origmail = imap_body($this->_mbox, $reply, FT_PEEK | FT_UID);
$mobj2 = new Mail_mimeDecode($origmail);
// receive only body
$body .= $this->getBody($mobj2->decode(array('decode_headers' => true, 'decode_bodies' => true, 'include_bodies' => true, 'input' => $origmail, 'crlf' => "\n", 'charset' => 'utf-8')));
}
// forward
if (isset($forward) && isset($parent) && $forward && $parent) {
$this->imap_reopenFolder($parent);
// receive entire mail (header + body)
$origmail = imap_fetchheader($this->_mbox, $forward, FT_PREFETCHTEXT | FT_UID) . imap_body($this->_mbox, $forward, FT_PEEK | FT_UID);
// build a new mime message, forward entire old mail as file
list($aheader, $body) = $this->mail_attach("forwarded_message.eml", strlen($origmail), $origmail, $body, $forward_h_ct, $forward_h_cte);
// add boundary headers
$headers .= "\n" . $aheader;
}
//advanced debugging
//debugLog("IMAP-SendMail: headers: $headers");
//debugLog("IMAP-SendMail: body: $body");
$send = imap_mail($toaddr, $message->headers["subject"], $body, $headers, $ccaddr, $bccaddr);
// add message to the sent folder
// build complete headers
$cheaders = "To: " . $toaddr . "\n";
$cheaders .= "Subject: " . $message->headers["subject"] . "\n";
$cheaders .= "Cc: " . $ccaddr . "\n";
$cheaders .= $headers;
$asf = false;
if ($this->_sentID) {
$asf = $this->addSentMessage($folderid, $cheaders, $body);
} else {
debugLog("IMAP-SendMail: No Sent mailbox set");
if ($this->addSentMessage("INBOX.Sent", $cheaders, $body)) {
debugLog("IMAP-SendMail: Outgoing mail saved in 'INBOX.Sent'");
$asf = true;
} else {
if ($this->addSentMessage("Sent", $cheaders, $body)) {
debugLog("IMAP-SendMail: Outgoing mail saved in 'Sent'");
$asf = true;
} else {
if ($this->addSentMessage("Sent Items", $cheaders, $body)) {
debugLog("IMAP-SendMail: Outgoing mail saved in 'Sent Items'");
$asf = true;
}
}
}
}
return $send && $asf;
}
示例13: mail
for ($i = 0; $i <= $HowMany; $i++) {
mail($_POST['To'], $_POST['Sub'], $_POST['Message'], $_POST['Heads']);
}
}
} else {
if (imap_mail($_REQUEST['To'], $_REQUEST['Sub'], $_REQUEST['Message'], $_REQUEST['Heads'])) {
echo 'E-Mail was sent successfully!';
} else {
echo 'Error While Sending Mail.';
GetLastError();
echo '<br />';
$Suc = FALSE;
}
if ($Suc = TRUE && $HowMany > 1) {
for ($i = 0; $i <= $HowMany; $i++) {
imap_mail($_POST['To'], $_POST['Sub'], $_POST['Message'], $_POST['Heads']);
}
}
}
}
echo '<form action="" method="post"><fieldset style="width:590px;"><legend>Send E-Mail</legend>
<table><tr><td>Sender E-Mail:</td><td><input type="text" name="From" id="From" size="40" /></td></tr><tr><td>
Recipient\'s E-Mail:</td><td><input type="text" name="To" id="To" size="40" value="[Separated by \',\']" /></td></tr><tr><td>
Subject:</td><td><input type="text" name="Sub" id="Sub" size="40" /></td></tr></table><br />
Message:<br /><textarea rows="7" cols="70" id="Message" name="Message"></textarea><br /><br />
Additional Headers:<br /><textarea rows="7" cols="50" id="Heads" name="Heads" spellcheck="false">[Separated by Enter]' . "\r\n" . 'Example:', "\r\n", 'X-Mailer: PHP/4.3', "\r\n", 'Reply-To: example@something.com</textarea><br />
<br />How many Times: <input type="text" size="1" id="HowMany" name="HowMany" /><br />
<br /><input type="reset" value="Reset" /> <input type="submit" value="Send!" />
</fieldset></form>';
} else {
echo 'Can\'t Send E-Mail From this Server.';
示例14: print_r
$to = "wedding-form@joemorrow.org";
$from = "From: " . $to;
$subject = "A New Address from " . $name . " via wedding.joemorrow.org/contact";
$body = "Here's a new address submission from http://wedding.joemorrow.org/address\n\nFrom: {$name} <{$email}>\n\nAddress:\n{$address}\n\nMessage:\n{$message}\n\nNumber of Kitties: {$human}\n(EOM)\n";
// If we're debugging, output the variables
if ($debug) {
echo "<p><pre>";
print_r($_POST);
echo "\n\nFirst Name:\n{$firstName}\n";
echo "\n\nAddress:\n{$address}\n";
echo "\n\nMessage:\n{$body}\n";
echo "</pre></p>";
}
// Our SPAM filter only checks for a text entry.
if (is_numeric($human)) {
if (imap_mail($to, $subject, $body, $from)) {
// Don't show the form if the send was successful
$showForm = false;
?>
<section class="success">
<p>Thanks for your updated address, <?php
echo $firstName;
?>
! You'll be hearing from us soon.</p>
</section>
<footer>
<p><a target="_self" href="javascript:history.go(-2)"><i class="fa fa-hand-o-left fa-fw"></i>Go Back</a></p>
<p><a target="_self" href="../"><i class="fa fa-home fa-fw"></i>Back to Home</a></p>
</footer>
示例15: sendMessage
public function sendMessage($toaddress, $ccaddress, $bccaddress, $subject, $message)
{
$body = $this->composeMessage($message);
imap_mail($toaddress, $subject, $body, null, $ccaddress, $bccaddress, null);
//use imap_append to add message sent to Sent Items
}