public function PHPMailer::AddEmbeddedImage in SMTP Authentication Support 7.2
Same name and namespace in other branches
- 5 smtp.module \PHPMailer::AddEmbeddedImage()
- 7 smtp.phpmailer.inc \PHPMailer::AddEmbeddedImage()
Adds an embedded attachment. This can include images, sounds, and just about any other document. Make sure to set the $type to an image type. For JPEG images use "image/jpeg" and for GIF images use "image/gif".
Parameters
string $path Path to the attachment.:
string $cid Content ID of the attachment. Use this to identify: the Id for accessing the image in an HTML form.
string $name Overrides the attachment name.:
string $encoding File encoding (see $Encoding).:
string $type File extension (MIME) type.:
Return value
bool
1 call to PHPMailer::AddEmbeddedImage()
- PHPMailer::MsgHTML in ./
smtp.phpmailer.inc - Evaluates the message and returns modifications for inline images and backgrounds @access public
File
- ./
smtp.phpmailer.inc, line 1791 - The mail handler class in smtp module, based on code of the phpmailer library, customized and relicensed to GPLv2.
Class
- PHPMailer
- PHPMailer - PHP email transport class NOTE: Requires PHP version 5 or later @package PHPMailer @author Andy Prevost @author Marcus Bointon @copyright 2004 - 2009 Andy Prevost
Code
public function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
if (!@is_file($path)) {
$this
->SetError(t('Could not access file: !nofile', array(
'!nofile' => $path,
)));
return FALSE;
}
$filename = basename($path);
if ($name == '') {
$name = $filename;
}
// Append to $attachment array
$this->attachment[] = array(
0 => $path,
1 => $filename,
2 => $name,
3 => $encoding,
4 => $type,
5 => FALSE,
// isStringAttachment
6 => 'inline',
7 => $cid,
);
return TRUE;
}