Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Gmail Api撰写并发送带有多个附件的电子邮件_Php_Laravel_Gmail_Gmail Api_Email Attachments - Fatal编程技术网

Php Gmail Api撰写并发送带有多个附件的电子邮件

Php Gmail Api撰写并发送带有多个附件的电子邮件,php,laravel,gmail,gmail-api,email-attachments,Php,Laravel,Gmail,Gmail Api,Email Attachments,我生成电子邮件的代码在下面的#php#laravel中提到 $message=新的Google_服务_Gmail_消息(); $mixedBoundaryString='mixedBoundaryString'; $relatedBoundaryString='relatedBoundaryString'; $alternativeBoundaryString='alternativeBoundaryString'; $subject=$request['subject']; $to=$requ

我生成电子邮件的代码在下面的#php#laravel中提到

$message=新的Google_服务_Gmail_消息();
$mixedBoundaryString='mixedBoundaryString';
$relatedBoundaryString='relatedBoundaryString';
$alternativeBoundaryString='alternativeBoundaryString';
$subject=$request['subject'];
$to=$request['to'];
$message_text=$request['contentText'];
$request['cc']=str_replace(“,”,$request['cc']);
$cc_tmp=explode(“;”,$request['cc']);
$cc=内爆(“,”,$cc_tmp);
$request['bcc']=str_replace(“,”,$request['bcc']);
$bcc_tmp=explode(“;”,$request['bcc']);
$bcc=内爆(“,”,$bcc_tmp);
$stripTagsMessageText=strip_标记($message_text);
$raw=“To:{$To}
抄送:{$Cc}
密件抄送:{$Bcc}
主题:{$Subject}
MIME版本:1.0
内容类型:多部分/混合;边界=\“{$mixedBoundaryString}”
--{$mixedBoundaryString}
内容类型:多部分/相关;边界=\“{$relatedBoundaryString}\”
--{$relatedBoundaryString}
内容类型:多部分/可选;边界=\“{$alternativeBoundaryString}”
--{$alternativeBoundaryString}
内容类型:文本/普通;字符集=\“utf-8”
内容传输编码:引用可打印
{$stripTagsMessageText}
--{$alternativeBoundaryString}
内容类型:text/html;字符集=\“utf-8”
内容传输编码:引用可打印
{$message_text}
--{$alternativeBoundaryString}--
";
if(设置($request['attachments')和计数($request['attachments'))>0){
foreach($request['attachments']作为$attachment){
如果(!为空($attachment)){
$location=public_path()。/email_attachments/sent/;
$filename=str_random(20)。'-'.$attachment->getClientOriginalName();
$file\u location=$attachment->move($location,$filename);
$mimetype=$attachment->getClientMimeType();
$attachmentName=$attachment->getClientOriginalName();
$base64Attachement=chunk\u split(base64\u编码(文件获取内容($location.$filename)),76,“\n”);
$raw.=”
--{$relatedBoundaryString}
内容类型:{$mimetype};名称=\“{$attachmentName}\”
内容传输编码:base64
内容处置:内联;文件名=\“{$attachmentName}\”
内容ID:
{$base64Attachement}”;
}
}
}
$raw.=”
--{$relatedBoundaryString}--
--{$mixedBoundaryString}--“;
$message->setRaw($this->base64url_encode($raw));
返回$message;
如果我在base64url\u编码之前打印预览数据,它将给出以下内容

To: divya.deltatech@gmail.com
Cc: soniya.deltatech@gmail.com
Bcc: divya@divyashr.com.np
Subject: Multiple Attachment
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="MixedBoundaryString"

--MixedBoundaryString
Content-Type: multipart/related; boundary="RelatedBoundaryString"

--RelatedBoundaryString
Content-Type: multipart/alternative; boundary="AlternativeBoundaryString"

--AlternativeBoundaryString
Content-Type: text/plain;charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Dear All,I’m writing to resign from my position as Web Developer, effective August 20, 2019.I’ve recently decided to go back to school, and my program starts in early September. I’m tendering my resignation now so that I can be as helpful as possible to you during the transition.I’ve truly enjoyed my time working with you and everyone else on our team at LMK. It’s rare to find a customer service role that offers as much opportunity to grow and learn and such a positive, inspiring team of people to grow and learn with.I’m particularly grateful for your guidance while I was considering furthering my education. Your support has meant so much to me. Please let me know if there’s anything I can do to help you find and train my replacement.Thanks, and best wishes,

--AlternativeBoundaryString
Content-Type: text/html;charset="utf-8"
Content-Transfer-Encoding: quoted-printable

<p style="box-sizing: border-box; margin: 0.875rem 0px; padding: 0px; font-family: Rubik, Arial, sans-serif; color: rgb(34, 34, 34); font-size: 17px;">Dear All,</p><p style="box-sizing: border-box; margin: 0.875rem 0px; padding: 0px; font-family: Rubik, Arial, sans-serif; color: rgb(34, 34, 34); font-size: 17px;">I’m writing to resign from my position as <span style="font-weight: bold;">Web Developer</span>, effective August 20, 2019.</p><p style="box-sizing: border-box; margin: 0.875rem 0px; padding: 0px; font-family: Rubik, Arial, sans-serif; color: rgb(34, 34, 34); font-size: 17px;">I’ve recently d<span style="text-decoration-line: underline;">ecided to go back to school, and my program starts in early September</span>. I’m tendering my resignation now so that I can be as helpful as possible to you during the transition.</p><blockquote style="box-sizing: border-box; margin: 0.875rem 0px; padding: 0px; font-family: Rubik, Arial, sans-serif; color: rgb(34, 34, 34); font-size: 17px;">I’ve truly enjoyed my time working with you and everyone else on our team at LMK. <span style="text-decoration-line: line-through;">It’s rare to find a customer service role that offers as much opportunity to grow</span> and learn and such a positive, inspiring team of people to grow and learn with.</blockquote><p style="box-sizing: border-box; margin: 0.875rem 0px; padding: 0px; font-family: Rubik, Arial, sans-serif; color: rgb(34, 34, 34); font-size: 17px;">I’m particularly grateful for your guidance while<span style="font-style: italic;"> I was considering furthering my education. </span>Your support has meant so much to me.&nbsp;</p><p style="box-sizing: border-box; margin: 0.875rem 0px; padding: 0px; font-family: Rubik, Arial, sans-serif; color: rgb(34, 34, 34); font-size: 17px;">Please let me know if there’s anything I can do to help you find and train my replacement.</p><p style="box-sizing: border-box; margin: 0.875rem 0px; padding: 0px; font-family: Rubik, Arial, sans-serif; color: rgb(34, 34, 34); font-size: 17px;">Thanks, and best wishes,</p>

--AlternativeBoundaryString--

--RelatedBoundaryString
Content-Type: image/jpeg;name="22366329_1711794525581687_2834310312601824228_n.jpg"
Content-Transfer-Encoding: base64
Content-Disposition: inline;filename="22366329_1711794525581687_2834310312601824228_n.jpg"
Content-ID: <divya.deltatech@gmail.com>

/9j/4AAQSkZJRgABAgAAAQABAAD/7QCcUGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAIAcAmcAFFJj
aVVyMDd0cHBaLTRWNkpodlZMHAIoAGJGQk1EMDEwMDBhYjYwMzAwMDA5NzEyMDAwMGM2MmEwMDAw
......
......
+QEQIiJ5HAAAnx/4H/k+v/sXI/TA/wDqP/Rx/wDiv+DjL/i//kOBgT6//WmTJ/jn/Bz/APe/+l9Y
aP8A+Ag3zx/+OZP/AMKfCcQ5e/2//ifdQ79XBRGr2Cvc/wD4lQYFLfP26xaoGV5P/wCJMCFF4C/8
+uEIDAz/2Q==

--RelatedBoundaryString
Content-Type: image/png;name="1561271605_apple-icon-60x60.png"
Content-Transfer-Encoding: base64
Content-Disposition: inline;filename="1561271605_apple-icon-60x60.png"
Content-ID: <divya.deltatech@gmail.com>

iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAM
8klEQVRogc2b23Mc1Z3HP7/T3XOf0UgjybpL1lh3WQEvhkCCMQV4F8gSCCSQha192D9iH/Zh/4p9
......
......
/EkeG5vg5yvL/O8nH3N++TOubW7gq42+IbFHTvqeEK7DiDCaLzAyM88T48f56coy/37hPd789CM2
arXDJUfaxB8BJejO2uWjqaEAAAAASUVORK5CYII=

--RelatedBoundaryString--

--MixedBoundaryString--

To:divya。deltatech@gmail.com
抄送:索尼娅。deltatech@gmail.com
密件抄送:divya@divyashr.com.np
主题:多重附件
MIME版本:1.0
内容类型:多部分/混合;boundary=“MixedBoundaryString”
--混合边界字符串
内容类型:多部分/相关;boundary=“RelatedBoundaryString”
--关联边界字符串
内容类型:多部分/备选;boundary=“AlternativeBoundaryString”
--交替边界字符串
内容类型:文本/纯文本;charset=“utf-8”
内容传输编码:引用可打印
亲爱的各位,我写这封信是为了辞去我的Web开发者职位,自2019年8月20日起生效。我最近决定重返学校,我的课程将于9月初开始。我现在提出辞职,以便在过渡期间尽可能地帮助你。我真的很高兴与你和LMK团队中的其他人一起工作。很少能找到一个能提供如此多成长和学习机会的客户服务角色,以及一个能与之共同成长和学习的积极、鼓舞人心的团队。在我考虑继续深造时,我特别感谢你的指导。你的支持对我意义重大。如果有什么我能帮你找到并培训我的替代者,请告诉我。谢谢,并致以最良好的祝愿,
--交替边界字符串
内容类型:text/html;charset=“utf-8”
内容传输编码:引用可打印
亲爱的各位,

>我写这封信是为了辞去我的网站开发者职位,自2019年8月20日起生效。

我最近决定重返学校,我的课程将于九月初开始。我现在提出辞职,以便在过渡期间尽可能为您提供帮助。

我真的很高兴与您和LMK团队中的其他人一起工作。很少能找到一个能提供如此多成长和学习机会的客户服务角色,以及一个如此积极、鼓舞人心的团队来成长和学习。

在我考虑继续深造时,我特别感谢你的指导。你的支持对我意义重大

请告诉我是否有什么我可以帮你找到并培训我的替代者。

谢谢,并致以最良好的祝愿

--交替边界字符串-- --关联边界字符串 内容类型:image/jpeg;name=“22366329_1711794525581687_2834310312601824228_n.jp
To: divya.deltatech@gmail.com
Cc: soniya.deltatech@gmail.com
Bcc: divya@divyashr.com.np
Subject: Multiple Attachment
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="MixedBoundaryString"

--MixedBoundaryString
Content-Type: multipart/related; boundary="RelatedBoundaryString"

--RelatedBoundaryString
Content-Type: multipart/alternative; boundary="AlternativeBoundaryString"

--AlternativeBoundaryString
Content-Type: text/plain;charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Dear All,I’m writing to resign from my position as Web Developer, effective August 20, 2019.I’ve recently decided to go back to school, and my program starts in early September. I’m tendering my resignation now so that I can be as helpful as possible to you during the transition.I’ve truly enjoyed my time working with you and everyone else on our team at LMK. It’s rare to find a customer service role that offers as much opportunity to grow and learn and such a positive, inspiring team of people to grow and learn with.I’m particularly grateful for your guidance while I was considering furthering my education. Your support has meant so much to me.&nbsp;Please let me know if there’s anything I can do to help you find and train my replacement.Thanks, and best wishes,

--AlternativeBoundaryString
Content-Type: text/html;charset="utf-8"
Content-Transfer-Encoding: quoted-printable

<p style="box-sizing: border-box; margin: 0.875rem 0px; padding: 0px; font-family: Rubik, Arial, sans-serif; color: rgb(34, 34, 34); font-size: 17px;">Dear All,</p><p style="box-sizing: border-box; margin: 0.875rem 0px; padding: 0px; font-family: Rubik, Arial, sans-serif; color: rgb(34, 34, 34); font-size: 17px;">I’m writing to resign from my position as <span style="font-weight: bold;">Web Developer</span>, effective August 20, 2019.</p><p style="box-sizing: border-box; margin: 0.875rem 0px; padding: 0px; font-family: Rubik, Arial, sans-serif; color: rgb(34, 34, 34); font-size: 17px;">I’ve recently d<span style="text-decoration-line: underline;">ecided to go back to school, and my program starts in early September</span>. I’m tendering my resignation now so that I can be as helpful as possible to you during the transition.</p><blockquote style="box-sizing: border-box; margin: 0.875rem 0px; padding: 0px; font-family: Rubik, Arial, sans-serif; color: rgb(34, 34, 34); font-size: 17px;">I’ve truly enjoyed my time working with you and everyone else on our team at LMK. <span style="text-decoration-line: line-through;">It’s rare to find a customer service role that offers as much opportunity to grow</span> and learn and such a positive, inspiring team of people to grow and learn with.</blockquote><p style="box-sizing: border-box; margin: 0.875rem 0px; padding: 0px; font-family: Rubik, Arial, sans-serif; color: rgb(34, 34, 34); font-size: 17px;">I’m particularly grateful for your guidance while<span style="font-style: italic;"> I was considering furthering my education. </span>Your support has meant so much to me.&nbsp;</p><p style="box-sizing: border-box; margin: 0.875rem 0px; padding: 0px; font-family: Rubik, Arial, sans-serif; color: rgb(34, 34, 34); font-size: 17px;">Please let me know if there’s anything I can do to help you find and train my replacement.</p><p style="box-sizing: border-box; margin: 0.875rem 0px; padding: 0px; font-family: Rubik, Arial, sans-serif; color: rgb(34, 34, 34); font-size: 17px;">Thanks, and best wishes,</p>

--AlternativeBoundaryString--

--RelatedBoundaryString
Content-Type: image/jpeg;name="22366329_1711794525581687_2834310312601824228_n.jpg"
Content-Transfer-Encoding: base64
Content-Disposition: inline;filename="22366329_1711794525581687_2834310312601824228_n.jpg"
Content-ID: <divya.deltatech@gmail.com>

/9j/4AAQSkZJRgABAgAAAQABAAD/7QCcUGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAIAcAmcAFFJj
aVVyMDd0cHBaLTRWNkpodlZMHAIoAGJGQk1EMDEwMDBhYjYwMzAwMDA5NzEyMDAwMGM2MmEwMDAw
......
......
+QEQIiJ5HAAAnx/4H/k+v/sXI/TA/wDqP/Rx/wDiv+DjL/i//kOBgT6//WmTJ/jn/Bz/APe/+l9Y
aP8A+Ag3zx/+OZP/AMKfCcQ5e/2//ifdQ79XBRGr2Cvc/wD4lQYFLfP26xaoGV5P/wCJMCFF4C/8
+uEIDAz/2Q==

--RelatedBoundaryString
Content-Type: image/png;name="1561271605_apple-icon-60x60.png"
Content-Transfer-Encoding: base64
Content-Disposition: inline;filename="1561271605_apple-icon-60x60.png"
Content-ID: <divya.deltatech@gmail.com>

iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAM
8klEQVRogc2b23Mc1Z3HP7/T3XOf0UgjybpL1lh3WQEvhkCCMQV4F8gSCCSQha192D9iH/Zh/4p9
......
......
/EkeG5vg5yvL/O8nH3N++TOubW7gq42+IbFHTvqeEK7DiDCaLzAyM88T48f56coy/37hPd789CM2
arXDJUfaxB8BJejO2uWjqaEAAAAASUVORK5CYII=

--RelatedBoundaryString--

--MixedBoundaryString--

--{$relatedBoundaryString}
Content-Type: {$mimetype};name=\"{$attachmentName}\"
Content-Transfer-Encoding: base64
Content-Disposition: inline;filename=\"{$attachmentName}\"
Content-ID: <{$to}>
--{$relatedBoundaryString}
Content-Type: {$mimetype};name=\"{$attachmentName}\"
Content-Transfer-Encoding: base64
Content-Disposition: inline;filename=\"{$attachmentName}\"
Content-ID: <{$attachmentName}>