function PHPMailer::AddEmbeddedImage in SMTP Authentication Support 5
Same name and namespace in other branches
- 7.2 smtp.phpmailer.inc \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
File
- ./
smtp.module, line 1748 - Enables drupal to send email directly to an SMTP server using authentication. Uses the PHPMailer class by Brent R. Matzelle.
Class
- PHPMailer
- PHPMailer - PHP email transport class @package PHPMailer @author Brent R. Matzelle @copyright 2001 - 2003 Brent R. Matzelle
Code
function AddEmbeddedImage($path, $cid, $name = "", $encoding = "base64", $type = "application/octet-stream") {
if (!@is_file($path)) {
$this
->SetError($this
->Lang("file_access") . $path);
return false;
}
$filename = basename($path);
if ($name == "") {
$name = $filename;
}
// Append to $attachment array
$cur = count($this->attachment);
$this->attachment[$cur][0] = $path;
$this->attachment[$cur][1] = $filename;
$this->attachment[$cur][2] = $name;
$this->attachment[$cur][3] = $encoding;
$this->attachment[$cur][4] = $type;
$this->attachment[$cur][5] = false;
// isStringAttachment
$this->attachment[$cur][6] = "inline";
$this->attachment[$cur][7] = $cid;
return true;
}