Server IP : 127.0.0.2 / Your IP : 3.144.112.72 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/vendor/laravel/framework/src/Illuminate/Mail/ |
Upload File : |
<?php namespace Illuminate\Mail; use Swift_Image; use Swift_Attachment; class Message { /** * The Swift Message instance. * * @var \Swift_Message */ protected $swift; /** * Create a new message instance. * * @param \Swift_Message $swift * @return void */ public function __construct($swift) { $this->swift = $swift; } /** * Add a "from" address to the message. * * @param string|array $address * @param string|null $name * @return $this */ public function from($address, $name = null) { $this->swift->setFrom($address, $name); return $this; } /** * Set the "sender" of the message. * * @param string|array $address * @param string|null $name * @return $this */ public function sender($address, $name = null) { $this->swift->setSender($address, $name); return $this; } /** * Set the "return path" of the message. * * @param string $address * @return $this */ public function returnPath($address) { $this->swift->setReturnPath($address); return $this; } /** * Add a recipient to the message. * * @param string|array $address * @param string|null $name * @param bool $override * @return $this */ public function to($address, $name = null, $override = false) { if ($override) { $this->swift->setTo($address, $name); return $this; } return $this->addAddresses($address, $name, 'To'); } /** * Add a carbon copy to the message. * * @param string|array $address * @param string|null $name * @param bool $override * @return $this */ public function cc($address, $name = null, $override = false) { if ($override) { $this->swift->setCc($address, $name); return $this; } return $this->addAddresses($address, $name, 'Cc'); } /** * Add a blind carbon copy to the message. * * @param string|array $address * @param string|null $name * @param bool $override * @return $this */ public function bcc($address, $name = null, $override = false) { if ($override) { $this->swift->setBcc($address, $name); return $this; } return $this->addAddresses($address, $name, 'Bcc'); } /** * Add a reply to address to the message. * * @param string|array $address * @param string|null $name * @return $this */ public function replyTo($address, $name = null) { return $this->addAddresses($address, $name, 'ReplyTo'); } /** * Add a recipient to the message. * * @param string|array $address * @param string $name * @param string $type * @return $this */ protected function addAddresses($address, $name, $type) { if (is_array($address)) { $this->swift->{"set{$type}"}($address, $name); } else { $this->swift->{"add{$type}"}($address, $name); } return $this; } /** * Set the subject of the message. * * @param string $subject * @return $this */ public function subject($subject) { $this->swift->setSubject($subject); return $this; } /** * Set the message priority level. * * @param int $level * @return $this */ public function priority($level) { $this->swift->setPriority($level); return $this; } /** * Attach a file to the message. * * @param string $file * @param array $options * @return $this */ public function attach($file, array $options = []) { $attachment = $this->createAttachmentFromPath($file); return $this->prepAttachment($attachment, $options); } /** * Create a Swift Attachment instance. * * @param string $file * @return \Swift_Attachment */ protected function createAttachmentFromPath($file) { return Swift_Attachment::fromPath($file); } /** * Attach in-memory data as an attachment. * * @param string $data * @param string $name * @param array $options * @return $this */ public function attachData($data, $name, array $options = []) { $attachment = $this->createAttachmentFromData($data, $name); return $this->prepAttachment($attachment, $options); } /** * Create a Swift Attachment instance from data. * * @param string $data * @param string $name * @return \Swift_Attachment */ protected function createAttachmentFromData($data, $name) { return Swift_Attachment::newInstance($data, $name); } /** * Embed a file in the message and get the CID. * * @param string $file * @return string */ public function embed($file) { return $this->swift->embed(Swift_Image::fromPath($file)); } /** * Embed in-memory data in the message and get the CID. * * @param string $data * @param string $name * @param string|null $contentType * @return string */ public function embedData($data, $name, $contentType = null) { $image = Swift_Image::newInstance($data, $name, $contentType); return $this->swift->embed($image); } /** * Prepare and attach the given attachment. * * @param \Swift_Attachment $attachment * @param array $options * @return $this */ protected function prepAttachment($attachment, $options = []) { // First we will check for a MIME type on the message, which instructs the // mail client on what type of attachment the file is so that it may be // downloaded correctly by the user. The MIME option is not required. if (isset($options['mime'])) { $attachment->setContentType($options['mime']); } // If an alternative name was given as an option, we will set that on this // attachment so that it will be downloaded with the desired names from // the developer, otherwise the default file names will get assigned. if (isset($options['as'])) { $attachment->setFilename($options['as']); } $this->swift->attach($attachment); return $this; } /** * Get the underlying Swift Message instance. * * @return \Swift_Message */ public function getSwiftMessage() { return $this->swift; } /** * Dynamically pass missing methods to the Swift instance. * * @param string $method * @param array $parameters * @return mixed */ public function __call($method, $parameters) { $callable = [$this->swift, $method]; return call_user_func_array($callable, $parameters); } }