Mailgun\Messages\MessageBuilder::addInlineImage PHP 메소드

addInlineImage() 공개 메소드

public addInlineImage ( string $inlineImagePath, string | null $inlineImageName = null ) : boolean
$inlineImagePath string
$inlineImageName string | null
리턴 boolean
    public function addInlineImage($inlineImagePath, $inlineImageName = null)
    {
        if (strpos($inlineImagePath, '@') !== 0) {
            throw new InvalidParameter(ExceptionMessages::INVALID_PARAMETER_INLINE);
        }
        $this->files['inline'][] = ['filePath' => $inlineImagePath, 'remoteName' => $inlineImageName];
        return true;
    }

Usage Example

예제 #1
0
파일: Message.php 프로젝트: bogardo/mailgun
 /**
  * Embed a file in the message and get the CID.
  *
  * @param string $path
  * @param string $name
  *
  * @return string
  */
 public function embed($path, $name = null)
 {
     $name = $name ?: basename($path);
     $this->messageBuilder->addInlineImage("@{$path}", $name);
     return "cid:{$name}";
 }