<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>技術相關 &#8211; 記下來</title>
	<atom:link href="https://noter.tw/share/tech/feed/" rel="self" type="application/rss+xml" />
	<link>https://noter.tw</link>
	<description>一路上踩到的坑、遇到的問題，一點一滴記下來，希望能幫助到需要的人~</description>
	<lastBuildDate>Sun, 14 Sep 2025 10:19:17 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.5</generator>

<image>
	<url>https://noter.tw/wp-content/uploads/cropped-old-1130742_1920-1-32x32.jpg</url>
	<title>技術相關 &#8211; 記下來</title>
	<link>https://noter.tw</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Stirling PDF: 自行架設全方位免費 PDF 線上工具</title>
		<link>https://noter.tw/12976/stirling-pdf-comprehensive-pdf-tool/</link>
					<comments>https://noter.tw/12976/stirling-pdf-comprehensive-pdf-tool/#respond</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Sun, 14 Sep 2025 10:19:15 +0000</pubDate>
				<category><![CDATA[技術相關]]></category>
		<category><![CDATA[軟體、工具]]></category>
		<category><![CDATA[軟體分享]]></category>
		<category><![CDATA[PDF 線上]]></category>
		<category><![CDATA[Stirling PDF]]></category>
		<category><![CDATA[PDF 處理]]></category>
		<category><![CDATA[自行架設]]></category>
		<category><![CDATA[Adobe Acrobat Pro Alternative]]></category>
		<category><![CDATA[self-hosting]]></category>
		<category><![CDATA[self-hosted]]></category>
		<category><![CDATA[全功能 PDF]]></category>
		<category><![CDATA[全方位 PDF]]></category>
		<category><![CDATA[Adobe Acrobat]]></category>
		<category><![CDATA[PDF 合併]]></category>
		<category><![CDATA[PDF 加密]]></category>
		<category><![CDATA[PDF]]></category>
		<category><![CDATA[PDF 刪除]]></category>
		<guid isPermaLink="false">https://noter.tw/?p=12976</guid>

					<description><![CDATA[<p>小蛙常常收到有要處理 PDF 的需求，像是合併、拆分、刪除其中一頁、加密 &#8230; 等，在沒有 Adobe Acrobat Pro 情況下，一般小蛙會直接使用 Mac 來處理，若是非機密性的 P&#46;&#46;&#46;</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/12976/stirling-pdf-comprehensive-pdf-tool/" data-wpel-link="internal">Stirling PDF: 自行架設全方位免費 PDF 線上工具</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>小蛙常常收到有要處理 PDF 的需求，像是合併、拆分、刪除其中一頁、加密 &#8230; 等，在沒有 Adobe Acrobat Pro 情況下，一般小蛙會直接使用 Mac 來處理，若是非機密性的 PDF 才敢使用線上工具處理，前陣子好友分享一套全方位免費 PDF 線上工具 Stirling PDF，重點是可以自己架設！這樣就不怕機密資料流出了，這篇文章記錄安裝設定的過程。</p>



<span id="more-12976"></span>



<h2 class="wp-block-heading para">架設 Stirling PDF</h2>



<p>想使用現成的可到 <a href="https://www.stirlingpdf.com/" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">Stirling PDF 官網<span class="wpel-icon wpel-image wpel-icon-6"></span></a>，或<a href="https://github.com/Stirling-Tools/Stirling-PDF" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">社群免費自架版<span class="wpel-icon wpel-image wpel-icon-6"></span></a>。</p>



<p>在得知 Stirling PDF 之後，立刻去找好朋友 ChatGPT 聊聊，得知 2 種安裝方式：(1) 直接安裝在系統上；(2) 透過 Docker 安裝。小蛙要安裝的這台主機正好有 Docker，於是使用了這個較簡單的方法。</p>



<h3 class="wp-block-heading para">1. 拉取 docker image</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">docker pull stirlingtools/stirling-pdf:latest</pre>



<h3 class="wp-block-heading para">2. 建立所需的資料夾</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">mkdir -p ~/StirlingPDF/{trainingData,extraConfigs,customFiles,logs,pipeline}</pre>



<h3 class="wp-block-heading para">3. 拉取 docker image</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">docker run -d \
  --name stirling-pdf \
  -p 8080:8080 \
  -v ~/StirlingPDF/trainingData:/usr/share/tessdata \
  -v ~/StirlingPDF/extraConfigs:/configs \
  -v ~/StirlingPDF/customFiles:/customFiles/ \
  -v ~/StirlingPDF/logs:/logs/ \
  -v ~/StirlingPDF/pipeline:/pipeline/ \
  -e DOCKER_ENABLE_SECURITY=false \
  -e LANGS=en_US \
  stirlingtools/stirling-pdf:latest</pre>



<h3 class="wp-block-heading para">4. 測試</h3>



<p>輸入 http://localhost/ 就可以看到畫面了</p>



<h2 class="wp-block-heading para">設定 Nginx 反向代理</h2>



<p>小蛙的主機使用 nginx 反向代理，還需要在 nginx 設定檔中加入以下設定</p>



<pre class="EnlighterJSRAW" data-enlighter-language="ini" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">server {
    listen 443 ssl;
    server_name __your_domain__;  # 替換成自己的域名

    client_max_body_size 300M;    # 上傳 PDF 的大小，可調整

    ssl_certificate         /etc/nginx/ssl/__your_cert__;
    ssl_certificate_key     /etc/nginx/ssl/__your_key__;

    location / {
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_pass http://localhost:8080;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
    }
}</pre>



<p>重啟 nginx 後，就能使用上面設定的網址來訪問 Stirling PDF 囉 ~ 以後處理 PDF 簡單輕鬆又安全！幾乎所有常見的功能都有了，大推。如果不放心這個工具放在網路上會被濫用，還可以透過 <a href="https://noter.tw/12974/cloudflare-zero-trust/" target="_blank" rel="noreferrer noopener" data-wpel-link="internal">使用 Cloudflare 使用 Zero Trust 原則保護特定網址</a> 多做一層防護喔！</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczOUEJBqlhNi9BTtExhiF7gtrAt76N07RC0DA2J6PH_Uhad8gP_wZQHANNovV2U-H-vvNh51BBHsfRCIl3bYOJ4rLQ-6d2Jsq-RwjLv9OXBPdUPJ42WvuikCopAJSX0LXiY2tH4hWy75Z8kROI1CeJBh=w1265-h940-rw" alt="AP1GczOUEJBqlhNi9BTtExhiF7gtrAt76N07RC0DA2J6PH Uhad8gP wZQHANNovV2U H vvNh51BBHsfRCIl3bYOJ4rLQ 6d2Jsq RwjLv9OXBPdUPJ42WvuikCopAJSX0LXiY2tH4hWy75Z8kROI1CeJBh=w1265 h940 rw Stirling PDF: 自行架設全方位免費 PDF 線上工具" title="Stirling PDF: 自行架設全方位免費 PDF 線上工具"></figure></div><p>這篇文章 <a rel="nofollow" href="https://noter.tw/12976/stirling-pdf-comprehensive-pdf-tool/" data-wpel-link="internal">Stirling PDF: 自行架設全方位免費 PDF 線上工具</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/12976/stirling-pdf-comprehensive-pdf-tool/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PHPMailer + Gmail OAuth2 寄信</title>
		<link>https://noter.tw/12780/phpmailer-gmail-oauth2-%e5%af%84%e4%bf%a1/</link>
					<comments>https://noter.tw/12780/phpmailer-gmail-oauth2-%e5%af%84%e4%bf%a1/#respond</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Thu, 25 Apr 2024 08:08:36 +0000</pubDate>
				<category><![CDATA[程式開發]]></category>
		<category><![CDATA[網頁後端]]></category>
		<category><![CDATA[技術相關]]></category>
		<category><![CDATA[已授權的重新導向 URI]]></category>
		<category><![CDATA[oauth2 refresh token]]></category>
		<category><![CDATA[PHPMailer]]></category>
		<category><![CDATA[OAuth 用戶端 ID]]></category>
		<category><![CDATA[Gmail API]]></category>
		<category><![CDATA[Google Cloud 憑證]]></category>
		<category><![CDATA[PHPMailer Gmail OAuth2]]></category>
		<category><![CDATA[OAuth2 憑證]]></category>
		<category><![CDATA[XOAUTH2]]></category>
		<category><![CDATA[OAuth]]></category>
		<category><![CDATA[建立 OAuth 用戶端 ID 憑證]]></category>
		<category><![CDATA[OAuth token]]></category>
		<category><![CDATA[Google Workspace]]></category>
		<category><![CDATA[PHP Gmail 寄信]]></category>
		<category><![CDATA[PHP 發送郵件]]></category>
		<category><![CDATA[get_oauth_token.php]]></category>
		<guid isPermaLink="false">https://noter.tw/?p=12780</guid>

					<description><![CDATA[<p>小蛙有個維護的系統使用 PHPMailer 透過 Gmail 帳號密碼發送郵件，近期收到 Google 寄來的通知「自 2024 年 9 月 30 日起，應用程式必須採用 OAuth 才能存取 Google Workspace 帳戶。系統將不再支援使用密碼 (應用程式密碼除外) 的存取行為。」為了避免哪一天突然通通都只支援 OAuth，趁現在有一點時間趕快來改一下。</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/12780/phpmailer-gmail-oauth2-%e5%af%84%e4%bf%a1/" data-wpel-link="internal">PHPMailer + Gmail OAuth2 寄信</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>小蛙有個維護的系統使用 PHPMailer 透過 Gmail 帳號密碼發送郵件，近期收到 Google 寄來的通知「自 2024 年 9 月 30 日起，應用程式必須採用 OAuth 才能存取 Google Workspace 帳戶。系統將不再支援使用密碼 (應用程式密碼除外) 的存取行為。」為了避免哪一天突然通通都只支援 OAuth，趁現在有一點時間趕快來改一下。</p>



<span id="more-12780"></span>



<p>PHPMailer + Gmail OAuth 發信大概有幾個步驟：</p>



<ol class="my-li bg-darkblue wp-block-list">
<li><strong>安裝必要套件</strong>：使用 composer 在網站上安裝 phpmailer/phpmailer 及 league/oauth2-google 套件。</li>



<li><strong>建立 OAuth 2.0 用戶端 ID 憑證</strong>：到 Goolge Cloud 建立一個專案，並開啟 Gmail API 與建立一個 OAuth 2.0 用戶端 ID 憑證。</li>



<li><strong>取得 Refresh Token</strong>：設定 <code>get_oauth_token.php</code> 通過 OAuth 驗證，取得 Refresh Token。</li>



<li><strong>使用 PHPMailer 寄信</strong>：使用 PHPMailer 搭配前幾步得到的資訊寄送郵件。</li>
</ol>



<h2 class="wp-block-heading para">安裝必要套件</h2>



<p>需使用 composer 安裝必要套件，沒有 composer 的話可參考<a href="https://getcomposer.org/doc/00-intro.md" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">這邊<span class="wpel-icon wpel-image wpel-icon-6"></span></a>。</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">composer require phpmailer/phpmailer
composer require league/oauth2-google</pre>



<h2 class="wp-block-heading para">建立 OAuth 2.0 用戶端 ID 憑證</h2>



<h3 class="wp-block-heading para">啟用 Gmail API</h3>



<p>進入到 <a href="https://console.cloud.google.com/apis/dashboard" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">Google Cloud<span class="wpel-icon wpel-image wpel-icon-6"></span></a>，點擊左上方專案下拉選單 -> 新增專案 -> 輸入專案名稱，只要自己能辨識的即可，下面若有機構、位置，也都必須填寫上去</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczP4fogGZPjU75mdxaeI0tKW2eGRS6FBUuaLQDUBqfgiO7knRvicztaTrMIUvqtpjyHL1b3_UA2wW586_u2pjqPXf2i5JVbEQwBDqsgfF_49ZwFj4gnTYZxNYJ6CP86gNEcwB1UuMCIhRLv6_xQfPFlq=w666-h715-s-rw-gm" alt="PHPMailer + Gmail OAuth 寄信 1" style="width:500px" title="PHPMailer + Gmail OAuth2 寄信"></figure></div>


<p>專案建立完成後進入該專案，左側選擇「已啟用的 API 和服務」，點擊「啟用 API 和服務」</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczMKjfxWGckFT4SDqI9q5OGQi6NYeo_gpu-MQduZVVo3A5ArRza7b9UuIB4DF8LMkVhGYIeyC8oGBTCOQcq0vh4m4SQIzI84ARFBNMbgCIoKTGo_FG8adK4gWlOjolBpIpv3Z4v0UDeI7X8-vnvo0S64=w714-h390-s-rw-gm" alt="PHPMailer + Gmail OAuth 寄信 2" style="width:500px" title="PHPMailer + Gmail OAuth2 寄信"></figure></div>


<p>找到並啟用 Gmail API</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczN60kf2CLZeKdaaKKq_T_dfsTQ51TsKgzgjJoK5oPxoAi69KAAQuqX3GWE5u5nNGBe7zP7V3EKceOYUe2cHXtLpFjLAbQgOm9lJQ1FVRBInF3Up-pmebuYjoRS37QywSXmEJk1rrieIxFPiD-oemF-X=w594-h401-s-rw-gm" alt="PHPMailer + Gmail OAuth 寄信 3" style="width:400px" title="PHPMailer + Gmail OAuth2 寄信"></figure></div>


<h3 class="wp-block-heading para">建立 OAuth 用戶端 ID 憑證</h3>



<p>成功啟用 Gmail API 後，左側進入「憑證」選單 -> 點擊「建立憑證」 -> OAuth 用戶端 ID</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczPJKZpCSzpeLLRDHvkcwdJD2f82V1YY0UX5OZE9ykHd8uya60uNODJxm49OV5r5Qmv3F1JLR1DFHrUrGDD2fMKWaHXiF2miu0JIAHax-roCaD5dAJI4A16PN-RdZG0xIlmNhSD3LIpm8fLS3FNqSA9x=w935-h456-s-rw-gm" alt="PHPMailer + Gmail OAuth 寄信 4" style="width:600px" title="PHPMailer + Gmail OAuth2 寄信"></figure></div>


<p>第一次建立需要先設定同意畫面，點擊「設定同意畫面」</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczOGpbByPCfX_QYNdc3Tty8-pY4dMxWJQdOxwQobKf0GaWAvTLjax_su14ODzwzsrdZ2RsU8t8OwBr2b4TWiI8OQ7ZStwA_Av-K3l8dkgTFGtlVaWcV1sravgQpNQQcVt2MZwamni3tLnDlWAd54SrMe=w690-h276-s-rw-gm" alt="PHPMailer + Gmail OAuth 寄信 5" style="width:500px" title="PHPMailer + Gmail OAuth2 寄信"></figure></div>


<p>我們的目的是完成至少一次 OAuth 驗證取得 Refresh Token，這邊選「內部」就可以了</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczPGy3-iYpG5LY2fG9QKVqTJAah6GW-_2JCtjqsHeeYV9y2dHxGjF_aW7IR-lFGfI3cnEJyLXg8h4p6x_AvY5CRhrizpFWg9Dc2aCUp-MDQ9_S6rgUDoKVxDP8hCWRUDNu29lPxlPo87aMlhY8pTL1gj=w679-h581-s-rw-gm" alt="PHPMailer + Gmail OAuth 寄信 6" style="width:400px" title="PHPMailer + Gmail OAuth2 寄信"></figure></div>


<p>應用程式名稱、使用者支援電子郵件及開發人員聯絡資訊為必填項目，其餘部份視情況填寫，填寫完成後點擊「儲存並繼續」。</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-1 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczN61095TO7WUG8Jydw_-ZEoOhID5Y4tzbiDnmw_EIlI3ueo2-T-LMeWGh0oEkOosg26OKJulTg1vTsPF-uCZD-5oXDv_iPtwv4-vlFaaULC10U_zRvGVVxjAtYVKQYxdm-QAunv4opzFP9zcAP3zcHN=w679-h798-s-rw-gm" alt="PHPMailer + Gmail OAuth 寄信 7" style="object-fit:cover" title="PHPMailer + Gmail OAuth2 寄信"></figure></div></div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczNQiuqmUzaJJl-XySD31aSUGYPYyVDAVZltwi4U-9m2cpKP-4gKABuJzPwt1Dg2HfeIHFasME78Z8_TRyyXzwcq_gwbpZpvd7UNRph2x2ekx6o4zuoMD1sGyutyLuIpulDbyxdU7OqLBtaW_Cl8opWg=w677-h862-s-rw-gm" alt="PHPMailer + Gmail OAuth 寄信 8" title="PHPMailer + Gmail OAuth2 寄信"></figure></div></div>
</div>



<p>第二步範圍部份直接留空，點擊「儲存並繼續」</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-2 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczMBKau2JTNrXXjqDFkP6vISLfQa_hyHJQZRr_w9v9na-CXiiEKI5e8TO7t0C3wKt5v-8aYVfi4YgRvXzNvvJ4QkjXPVHZBtmBlt4H3FkXCyXPGKRSNUNObiptfhmJ1UEhYPT5loGB9gTJ6wZKmZvJNA=w676-h552-s-rw-gm" alt="PHPMailer + Gmail OAuth 寄信 9" title="PHPMailer + Gmail OAuth2 寄信"></figure></div></div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczPL1myaeyJMZsXqKb_MX2HErqMs1VuvwGiBzmkDAyYLb4BoaNkDvV1DS72TAcrkCDLkkAsGJSavFnwjg_t-cq28V3ezmndNqK-Z2OqmDslV5_YMKhD8Kq8jk3Om8akIA3lSIImxgLQfyE3e28hJ5JIh=w676-h537-s-rw-gm" alt="PHPMailer + Gmail OAuth 寄信 10" title="PHPMailer + Gmail OAuth2 寄信"></figure></div></div>
</div>



<p>OAuth 同意畫面建立完成</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-3 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczPNN115kjpIKr-OPaknHyw3-TG0PVuuC9RCkdtZP5YgXMIQ8tq4-IpdYERZJ4wm0X8CFzz4nmvnSuPMhuXXuvLHu-qoQbJ7VAuR-Nu28p6jfmQmgkYYzJm6PDPPONbVzFuUCR6vR745pdeEq9fxllq2=w675-h617-s-rw-gm" alt="PHPMailer + Gmail OAuth 寄信 11" title="PHPMailer + Gmail OAuth2 寄信"></figure></div></div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczP6GUlp18EkN6JAvl90LMqTV67IcvEvLRLdIZN5eL-a97ABLE9FficqfhZqCGq8hrSjQBGRmyDuFp2FP7OSTC4iwXY5Eq_SPh39XTBoGN0NH2paLIG5b8UsF4cawd3WMvmaiEUSKJvyAX3eAolyW6C7=w676-h569-s-rw-gm" alt="PHPMailer + Gmail OAuth 寄信 12" style="width:416px;height:auto" title="PHPMailer + Gmail OAuth2 寄信"></figure></div></div>
</div>



<p>再回到「憑證」->「建立憑證」->「OAuth 用戶端 ID」</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczPJKZpCSzpeLLRDHvkcwdJD2f82V1YY0UX5OZE9ykHd8uya60uNODJxm49OV5r5Qmv3F1JLR1DFHrUrGDD2fMKWaHXiF2miu0JIAHax-roCaD5dAJI4A16PN-RdZG0xIlmNhSD3LIpm8fLS3FNqSA9x=w935-h456-s-rw-gm" alt="PHPMailer + Gmail OAuth 寄信 13" style="width:600px" title="PHPMailer + Gmail OAuth2 寄信"></figure></div>


<p>應用程式類型選擇「網頁應用程式」，名稱為必填，可以跟小蛙一樣輸入 PHPMailer，只要能辨識即可。「已授權的重新導向 URI」填入網站下 phpmailer 套件下的 <code>get_oauth_token.php</code> 路徑 (也可以把它拉出來到外層比較好處理的地方)，小蛙這邊的例子是 </p>



<pre class="wp-block-preformatted">https://xx.xxx/vendor/phpmailer/phpmailer/get_oauth_token.php</pre>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczOvK99odz0V_ok4Ie8wEihuHHv3Xd3nohjEQ1SmNSN1I50Ee6aQvGsCmfK7gHRbfmJ5ZcSVeeErcTpRocoGuWztkqtHUyZt1oilrTZdcgLYnkeM8e4ZMt7Am8nv05r2prtZfGseGj2stkKXgvBz7dgz=w681-h993-s-rw-gm" alt="PHPMailer + Gmail OAuth 寄信 14" style="width:503px" title="PHPMailer + Gmail OAuth2 寄信"></figure></div>


<p>建立完成後會得到<strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">用戶端編號</mark></strong>及<mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color"><strong>用戶端密鑰</strong></mark>，先存起來等一下馬上會用到。</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczPcJ7LUPlQ7amLYg7ihWiFq4zwGti6hcZPBNouXbgkQ_tRXUQmQ9CrD9mPV_-LsRN2wybLy7tyxGnXAI0ndlSzMC1TGMR3QuT8TNQYwXeBn6HTxwvEE_J_U_vmVtEymVD4jh9EnFf4UYMtweBlLZ2K1=w570-h480-s-rw-gm" alt="PHPMailer + Gmail OAuth 寄信 15" style="width:400px" title="PHPMailer + Gmail OAuth2 寄信"></figure></div>


<h2 class="wp-block-heading para">取得 Refresh Token</h2>



<p>找到 PHPMailer 下的 <code>get_oauth_token.php</code> (預設應該會在網頁目錄下的 <code>vender/phpmailer/phpmailer/</code>)，PHPMailer 原始附帶的檔案會一直卡在 Provider missing 或 Invalid state，沒辦法正確取得 Refresh Token，因此小蛙對 <code>get_oauth_token.php</code> 做了一些修改，確保可以拿到 token。</p>



<pre class="EnlighterJSRAW" data-enlighter-language="php" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?php
/**
 * PHPMailer - PHP email creation and transport class.
 * PHP Version 5.5
 * @package PHPMailer
 * @see https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
 * @author Marcus Bointon (Synchro/coolbru) &lt;phpmailer@synchromedia.co.uk>
 * @author Jim Jagielski (jimjag) &lt;jimjag@gmail.com>
 * @author Andy Prevost (codeworxtech) &lt;codeworxtech@users.sourceforge.net>
 * @author Brent R. Matzelle (original founder)
 * @copyright 2012 - 2020 Marcus Bointon
 * @copyright 2010 - 2012 Jim Jagielski
 * @copyright 2004 - 2009 Andy Prevost
 * @license https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html GNU Lesser General Public License
 * @note This program is distributed in the hope that it will be useful - WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.
 */

/**
 * Get an OAuth2 token from an OAuth2 provider.
 * * Install this script on your server so that it's accessible
 * as [https/http]://&lt;yourdomain>/&lt;folder>/get_oauth_token.php
 * e.g.: http://localhost/phpmailer/get_oauth_token.php
 * * Ensure dependencies are installed with 'composer install'
 * * Set up an app in your Google/Yahoo/Microsoft account
 * * Set the script address as the app's redirect URL
 * If no refresh token is obtained when running this file,
 * revoke access to your app and run the script again.
 */

namespace PHPMailer\PHPMailer;

// 用來看錯誤訊息以及刪除 opcache
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
@opcache_reset();
	
/**
 * Aliases for League Provider Classes
 * Make sure you have added these to your composer.json and run `composer install`
 * Plenty to choose from here:
 * @see https://oauth2-client.thephpleague.com/providers/thirdparty/
 */
//@see https://github.com/thephpleague/oauth2-google
use League\OAuth2\Client\Provider\Google;

// 根據自己的 vendor 路徑進行調整
require '../../autoload.php';

session_start();

// 改成剛剛在 Google Cloud 上設定的值
$providerName = 'Google';
// 用戶端編號
$clientId = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com';
// 用戶端密碼
$clientSecret = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
// 已授權的重新導向 URI
$redirectUri = 'https://xxx.xxxx.xxx/get_oauth_token.php';

$_SESSION['provider'] = $providerName;
$_SESSION['clientId'] = $clientId;
$_SESSION['clientSecret'] = $clientSecret;

$params = [
    'clientId' => $clientId,
    'clientSecret' => $clientSecret,
    'redirectUri' => $redirectUri,
    'accessType' => 'offline'
];

$options = [];
$provider = null;

switch ($providerName) {
    case 'Google':
        $provider = new Google($params);
        $options = [
            'scope' => [
                'https://mail.google.com/'
            ]
        ];
        break;
}

if (null === $provider) {
    exit('Provider missing');
}

if (!isset($_GET['code'])) {
    //If we don't have an authorization code then get one
    $authUrl = $provider->getAuthorizationUrl($options);
    $_SESSION['oauth2state'] = $provider->getState();
    header('Location: ' . $authUrl);
    exit;
    //Check given state against previously stored one to mitigate CSRF attack
	// 這段不註解掉的話，會一直卡在 Invalid state，沒辦法拿到正確的 token
/*} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {
	error_log("3333");
	error_log("state 3333 " . $_SESSION['oauth2state']);
    //unset($_SESSION['oauth2state']);
    //unset($_SESSION['provider']);
    exit('Invalid state');*/
} else {
    //unset($_SESSION['provider']);
    //Try to get an access token (using the authorization code grant)
    $token = $provider->getAccessToken(
        'authorization_code',
        [
            'code' => $_GET['code']
        ]
    );
    //Use this to interact with an API on the users behalf
    //Use this to get a new access token if the old one expires
    echo 'Refresh Token: ', htmlspecialchars($token->getRefreshToken());
}</pre>



<p>將內容貼上後，開啟瀏覽器連到該網址 (就是<strong>已授權的重新導向 URI)</strong> 開始進入 OAuth 登入流程，選擇要登入的帳號</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczNd2HKRgMmOhBQaMmcC9pgUefAAsic1hkMqQzNHntO-1WCADxGh2gI74MXUtCztrElVXrZnqGeFwdlhg_Wu_VqUPq8esg9tm6kbcFcFJ6ixXkpRNfY7_t6sFZkMkzJBqqt9NtKBjoHpawuXktXa34LZ=w1058-h401-s-rw-gm" alt="PHPMailer + Gmail OAuth 寄信 16" style="width:700px" title="PHPMailer + Gmail OAuth2 寄信"></figure></div>


<p>確認登入</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczNyIy5svb1IInWm1pj7vJurWmbOEW6vM4LNL0JxtFFqilMaB_mu_PT3WV-MMYfXhKIDG99pTDOlE9fOKxFH8Z4MUhbM-E-bWcSaOt5cJ3hoNDTeWIut3PJ3g-TgfLLJZNkOiyQjGLX6-Yr4VXKBW7sh=w1063-h490-s-rw-gm" alt="PHPMailer + Gmail OAuth 寄信 17" style="width:700px" title="PHPMailer + Gmail OAuth2 寄信"></figure></div>


<p>信任應用程式</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczOW1-cRB-uxqhR9v7znPOoAw006Lx3tuBqFpba4WSijsidXKh0hKuWr1kvTz7KYfo0n38zK11rLkHPdvRNdOIqcpKiQcYfUz3zLxmJomAcC5j_gg2zUM8-yvCaGCw4EWqImteEhvYos6aLjoRAoojr2=w1057-h699-s-rw-gm" alt="PHPMailer + Gmail OAuth 寄信 18" style="width:700px" title="PHPMailer + Gmail OAuth2 寄信"></figure></div>


<p>最後會印出 Refresh Token: xxxxxxxxxx，這個 token 一定要存好，少了這個 PHPMailer 就沒辦法透過 OAuth 驗證寄信喔，原本以為 <code>get_oauth_token.php</code> 每次執行應該 &#8220;有機會&#8221; 去換一個可使用的 Token 回來，不過再執行一次會發現 Refresh Token: 變成空白。</p>


<div class="wp-block-image">
<figure class="aligncenter"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczMAEzc9EkM0XaVMs8px7YKL3EXAUJ2L_uJ8YlSTBBnEJAP8BH4JqC2s_b5_Rm1LNffiyRiTBmehd0jhvLbPhpAslSkq-8Lx1BfxwSTfg1jLVcAgOcadwiOl_V0YmZzKy86GplsW1NK61FBz9sCKGyCH=w861-h72-s-rw-gm" alt="AP1GczMAEzc9EkM0XaVMs8px7YKL3EXAUJ2L uJ8YlSTBBnEJAP8BH4JqC2s b5 Rm1LNffiyRiTBmehd0jhvLbPhpAslSkq 8Lx1BfxwSTfg1jLVcAgOcadwiOl V0YmZzKy86GplsW1NK61FBz9sCKGyCH=w861 h72 s rw gm PHPMailer + Gmail OAuth2 寄信" title="PHPMailer + Gmail OAuth2 寄信"></figure></div>


<p>到這邊就成功取得可以使用的 Token 了，回到 PHPMailer 寄信程式吧！</p>



<h2 class="wp-block-heading para">使用 PHPMailer 寄信</h2>



<p>複製下面的檔案，視自身情況修改幾個地方：</p>



<ol class="my-li bg-darkblue wp-block-list">
<li><strong>require(&#8216;./vendor/autoload.php&#8217;);</strong>：將位置指向正確的路徑。</li>



<li><strong>$client_id</strong>：前面步驟取得的用戶端編號。</li>



<li><strong>$client_secret</strong>：前面步驟取得的用戶端密碼。</li>



<li><strong>$refresh_token</strong>：前面步驟取得的 Token。</li>



<li><strong>$email</strong>：前面步驟通過 OAuth 的信箱。</li>



<li>信件相關之寄件人、收件人、主旨、內容 &#8230; 等。</li>
</ol>



<pre class="EnlighterJSRAW" data-enlighter-language="php" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?php

// 用來看錯誤訊息以及刪除 opcache
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
@opcache_reset();

// 根據自己的路徑修改 composer 的載入位置
require('./vendor/autoload.php');

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
use PHPMailer\PHPMailer\OAuth;
use League\OAuth2\Client\Provider\Google;

// 用戶端編號
$client_id 	= 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com';
// 用戶端密碼
$client_secret 	= 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
// 從前一個步驟取得的 Token
$refresh_token  = '1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxg';
// OAuth 的信箱
$email		= 'xxxxxxx@xxxxxxx';

$mail = new PHPMailer(true);

$provider = new Google(
	[
		'clientId' => $client_id,
		'clientSecret' => $client_secret,
	]
);

$mail->setOAuth(
	new OAuth(
		[
			'provider'     => $provider,
			'clientId'     => $client_id,
			'clientSecret' => $client_secret,
			'refreshToken' => $refresh_token,
			'userName'     => $email,
		]
	)
);

$mail->isSMTP();

$mail->SMTPDebug 	= 3;				// 如果需要顯示debug內容,測完確定沒問題請改成 0
$mail->SMTPAuth 	= true; 
$mail->SMTPSecure 	= 'tls';
$mail->AuthType 	= 'XOAUTH2';
$mail->Host 		= "smtp.gmail.com";
$mail->Port 		= 587;
$mail->CharSet 		= "utf-8";

$mail->setFrom('寄件人信箱', '寄件人名稱');    // 寄件人
$mail->addAddress('收件人信箱', '收件人名稱'); // 收件人
$mail->isHTML(true);                         // 寄送 HTML 格式郵件

$mail->Subject = "郵件主旨";                  // 主旨
$mail->Body    = "&lt;Strong>測試&lt;/Strong>";     // 信件內容
$mail->AltBody = "測試";                      // 無法顯示 HTML 時的內容

$mail->send();

?></pre>



<p>一切就緒後連到該寄信的 PHP 頁面，就可以成功把信寄出囉！</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczMLz2nu2nJ4oC9XUvFKUNbJNFysGsEQYN9LUHzuBmiEiyxnq5avpPb8-nMINhWVug9WD-guXHdUyfrte1yUxdbLU9O4rRn0fxZZ59U1vF0-j_1XofQvqYgfIHzmGwr-hf9y1ccy9TBervTm_5lZ7Y6w=w630-h363-s-rw-gm" alt="PHPMailer + Gmail OAuth 寄信 19" style="width:400px" title="PHPMailer + Gmail OAuth2 寄信"></figure></div>


<pre class="wp-block-preformatted">延伸閱讀：<a href="https://noter.tw/10744/google-%e8%a9%a6%e7%ae%97%e8%a1%a8%e6%89%b9%e9%87%8f%e7%99%bc%e9%80%81-email-yamm/" data-wpel-link="internal">Google 試算表批量發送 Email (免費版每日 50 封)</a></pre>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/12780/phpmailer-gmail-oauth2-%e5%af%84%e4%bf%a1/" data-wpel-link="internal">PHPMailer + Gmail OAuth2 寄信</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/12780/phpmailer-gmail-oauth2-%e5%af%84%e4%bf%a1/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>IFTTT 收費後的免費替代方案 Make</title>
		<link>https://noter.tw/12721/ifttt-%e6%94%b6%e8%b2%bb%e5%be%8c%e7%9a%84%e5%85%8d%e8%b2%bb%e6%9b%bf%e4%bb%a3%e6%96%b9%e6%a1%88-make/</link>
					<comments>https://noter.tw/12721/ifttt-%e6%94%b6%e8%b2%bb%e5%be%8c%e7%9a%84%e5%85%8d%e8%b2%bb%e6%9b%bf%e4%bb%a3%e6%96%b9%e6%a1%88-make/#comments</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Tue, 05 Mar 2024 04:20:00 +0000</pubDate>
				<category><![CDATA[軟體、工具]]></category>
		<category><![CDATA[軟體分享]]></category>
		<category><![CDATA[技巧分享]]></category>
		<category><![CDATA[技術相關]]></category>
		<category><![CDATA[IFTTT 替代]]></category>
		<category><![CDATA[發送 LINE 訊息]]></category>
		<category><![CDATA[LINE API]]></category>
		<category><![CDATA[withMake]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[Webhook]]></category>
		<category><![CDATA[透過 webhook 發送 LINE]]></category>
		<category><![CDATA[LINE module]]></category>
		<category><![CDATA[IFTTT]]></category>
		<category><![CDATA[LINE 通知]]></category>
		<category><![CDATA[Make]]></category>
		<category><![CDATA[觸發器]]></category>
		<category><![CDATA[自動化工具]]></category>
		<guid isPermaLink="false">https://noter.tw/?p=12721</guid>

					<description><![CDATA[<p>IFTTT 是「If This Then That」各取首字的縮寫，白話意思是「如果這樣然後那樣」也就是說當某個設定好的條件發生時就接著執行設定好的動作，小蛙原本工作上使用了 IFTTT 裡面提供的 webhook 功能，但後來改成 Pro 收費訂閱才可以使用，於是找到另一套可替代 IFTTT 的工具 Make。</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/12721/ifttt-%e6%94%b6%e8%b2%bb%e5%be%8c%e7%9a%84%e5%85%8d%e8%b2%bb%e6%9b%bf%e4%bb%a3%e6%96%b9%e6%a1%88-make/" data-wpel-link="internal">IFTTT 收費後的免費替代方案 Make</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>IFTTT 是「<strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">I</mark></strong>f <strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">T</mark></strong>his <strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">T</mark></strong>hen <mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color"><strong>T</strong></mark>hat」各取首字的縮寫，白話意思是「如果這樣然後那樣」也就是說當某個設定好的條件發生時就接著執行設定好的動作，小蛙原本工作上使用了 IFTTT 裡面提供的 webhook 功能，但後來改成 Pro 收費訂閱才可以使用，於是找到另一套可替代 IFTTT 的工具 <strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">Make</mark></strong>。</p>



<span id="more-12721"></span>



<p><a href="https://ifttt.com/" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">IFTTT<span class="wpel-icon wpel-image wpel-icon-6"></span></a> 在工作常被我們用來當作一個傳遞訊息的媒介，例如：當某個網路服務發生錯誤時，透過 LINE 通知，隨著 IFTTT 將該功能進行收費後，程式也隨之停擺；加上為了追蹤 YouTube 訂閱數，閒暇時寫了一支在訂閱數發生變化時發送 LINE 通知的工具也隨著休眠，在還沒有購買 IFTTT pro 前，先來介紹這套可以免費透過 webhook 發送 LINE 通知的好用工具－<a href="https://www.make.com/en" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">Make<span class="wpel-icon wpel-image wpel-icon-6"></span></a>。</p>



<h2 class="wp-block-heading para">IFTTT 替代方案 &#8211; Make 收費與註冊</h2>



<p>免費版本的限制是每個月只能接受 1,000 次請求，以小蛙的狀況 1,000 個綽綽有餘，價位看起來比 IFTTT 還要貴，每個月從 9 元 ~ 29 元不等</p>


<div class="wp-block-image">
<figure class="aligncenter"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczMaMD7Vwtkh8h1oBzJw71m8CHZGHDVSskg_zx32sFR5lYk0-j1_sYzWXeOYBox48W_utQM0p-Vhx_WgBbnBS5H4GbPDVoWHmKUYD-AQDhjiDH0EfeS-FCPyOGJ20GrBK0hpKi1Pdk8grt3IxtQxwWgx=w1345-h869-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 收費 Price Plan" title="IFTTT 收費後的免費替代方案 Make"></figure></div>


<p>(1) 首先連到 make 首頁，點擊右上方 Get started free 進行註冊</p>


<div class="wp-block-image">
<figure class="aligncenter"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczOOtkrxXm1pYjJveAQCcPmGSappGLtn3ZNREdJHjbqSMqhFVkOuRn4Rd2T-dvdPp4QkJI6IqEAClkPzOE6oFbZVOawUCnnFmZuuiJrNA6IEn6RLHNIeCUtDHh-eI_vRcAyQZDp1mItFy3eAdFf8EODi=w1474-h982-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 首頁" title="IFTTT 收費後的免費替代方案 Make"></figure></div>


<p>(2) 輸入姓名，Email 及密碼，Hosting Region 是指帳號資料放置的位置，可以選擇 EU 歐洲或是 US 美國，Country 選擇 Taiwan 後點擊 Sign up for FREE</p>


<div class="wp-block-image">
<figure class="aligncenter"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczN17zOIwYBYHnyoRvXulsXY__MIjOysq15ne5BXkCLpt7rBUqlHn4phTAfpyj3QMKLKVOdvN6Xr20FfVMcLeIMpAMk5QgfA8tZ4jgPJcI2siCFtxDJv75TwGaW8PXFXuOXimyqeq8W9SYpxUNgolHeG=w1474-h982-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - Sign up 註冊" title="IFTTT 收費後的免費替代方案 Make"></figure></div>


<p>(3) Make 會陸續問幾個問題，根據自己的狀況選取，像是你的角色、你使用自動化工具 Make 的目的、你對自動化工具的經驗、你怎麼知道 Make 的、組織規模人數 &#8230; 等</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-4 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczO7RH16rUxYIxLAgZl1nS6Wm7iws0hZGLxjSj1wIl-OinEqifkZkY74il_yVQl3J7oM3nxa8FLSSJrBChSzb54CZqc2Q2sb9FZ2_-I4ezzGewmKRqyWwD18Co2qMxnjbOKNc-I7zJ7ZS8Lu4bQufcF1=w703-h618-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 角色" title="IFTTT 收費後的免費替代方案 Make"></figure></div></div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczN7ptR2sa3YMPyP4tLPk0O9NFqJ4BsioMOLAOUJ9znEBp_-4tl8YExa7C_pa7viT0PvYIIsNHOikCKYhR2WFCFBCbxg7LNFI4P0xhBjXDlum6blLZgdMio_27W17aNpYelgW6SnS-NbNddMC6QOqWrQ=w705-h675-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 目的" title="IFTTT 收費後的免費替代方案 Make"></figure></div></div>
</div>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-5 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczOp5H8ViTUOvA2ZWBTeC-atNj5I_V_0xxgIV3LUJgIJLZoQbbgILTQBbN7X6fM76XFku75u5ops7jeRS0Typ7zWnMRwmXbeymurgt5Givqk74Mfkq7lgGnVo4USENc4oZujhlXXxifp_y5qRLAyC4Xg=w667-h371-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 經驗" title="IFTTT 收費後的免費替代方案 Make"></figure></div></div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczN_A5Htk5SmBHWmvoeCOh4TAlpY5PFOJqvJzTZtRcYBU8PMwiy0s8k3YsohtgW_FOdIaCII5c6Hagip2Rm4wqPyA-FDrUt121MyP3YT2LHL5FTdCh97H8tMqqFEP5knbVFbnm1lC2PsZzK_XjnMqfki=w932-h464-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 資訊來源" title="IFTTT 收費後的免費替代方案 Make"></figure></div></div>
</div>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczN032n4EWgkvY_CXWu55LlWkd8b6WOMMLoSWcI0tEu4kHljn6EW7VGXsK4NsIvzjA8HfeWjFMGRGH5SE7Nn1iYe24a56m9tdu9lS_wCcaaXdM0WbdLzoQY_zYpAQ7qKlSHfG39lN5Wtw0NaB3fPnFv5=w934-h323-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 組織規模" style="width:600px" title="IFTTT 收費後的免費替代方案 Make"></figure></div>


<p>(4) 註冊完成後，收到一封電子郵件確認函，點擊 Verify email 進行驗證</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczM6OS6mcc2MqaWlr5PQ38bVdpXutpw4zjpQT8Mv8SOugXPG1TZVsAhSlRwCkH8EtS3owAxxDMGO8nANct1SIMN3CJFyhGdg7KKiVUGMT-cKNcoWQVF7RKeujoto8gWCMKOuXlnHFimgsT1HIvR0otXb=w869-h572-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 驗證信" style="width:500px;height:auto" title="IFTTT 收費後的免費替代方案 Make"></figure></div>


<h2 class="wp-block-heading para">建立及設定 Make Scenario</h2>



<p>(5) 第一次登入進到首頁後，畫面右上方可以看到 Create a new scenario，建立一個新的腳本</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczOZRLt7Ca3rVEKsq8g-y3qkyg5OeR8PLeo_cWFjwavAOQHUVeUyP3icPFt3QNxQkYT5wLWT2IRLhwD-In84dRwMArJWYm2xsIF8F13mWPqlafxHszzH-FfTu4jl7w_U2zLPnqE8BIfXEvfj_ZSNwPEB=w690-h153-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 建立 scenario" style="width:600px" title="IFTTT 收費後的免費替代方案 Make"></figure></div>


<h3 class="wp-block-heading para">建立 Webhook 模組</h3>



<p>(6) 點擊畫面上大大的 + 按鈕，旁邊開啟一個視窗是要使用的工具，在下方搜尋 webhook 後點擊 Webhooks，讓我們的 Make 可以接受來自網址的觸發方式 (trigger)</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczOsPIOjs5BhGXX22Fy5MjkJw2AiINssTW7hQV5II7tf2HMPf4uSshON11DQQtT8bQF950xF8_EqSIkQcnstjy5MCQLd17X_pAjn4b2Gtk-tqr_JHD3hA7lA7ol18O1y96S-xzkTnCDG6663h0N5DFcX=w1464-h982-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 建立 Webhook 模組" style="width:600px" title="IFTTT 收費後的免費替代方案 Make"></figure></div>


<p>(7) TRIGGERS 選擇 Custom webhook</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczM7USTzECxHvN5IkLIBZb6WeCrGJwmqztvD67vP944QX0rTKiK1L-6jloGsnTt8_3SaiL8UcV3x1XYr0lYEC6J_keMaSNc0foj2PLufQj1eHoJErJaaK-R5k-mSFgeyENoSeC7y0734-1PJjkdmxak8=w826-h386-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - TRIGGER" style="width:500px" title="IFTTT 收費後的免費替代方案 Make"></figure></div>


<p>(8) 點擊 Create a webhook 開始建立自訂的 webhook</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczOlFbs-sIP-Cq2kxoO3Rw63_hX-hfNWxQ-FrQA5kvyiVZ3p28B3j9epH6SUwz6xtFVz5Bq0hqxUAVSzBW8mKM00gKgf1SL7uJaTmvHbf1yfYogeIE1OjTMnOvQ8My6DwCQwgZbmE5r2VDVqvwRunDHk=w890-h417-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 建立 Webhook 模組" style="width:500px" title="IFTTT 收費後的免費替代方案 Make"></figure></div>


<p>(9) 輸入 Webhook 的名字，如果你怕自己的 webhook 被盜用，可以設定特定 IP，讓 webhook 只接受特定 IP 發送的請求</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczOLmafJkxB8KHQbAHWrRUzh4_EQaYLR2XDCrLpZ9Sh0ehM8h6Zc4jonw8vpIzzyDr1YpetXCd5hRvZ3Xz1EksegIBjzqfjhpBykC91-G_A1NYs3609iGrNPXyZAqG2nxYbhbwUUVVR8DkkhNQ_UA5og=w571-h496-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 建立 Webhook 模組" style="width:500px" title="IFTTT 收費後的免費替代方案 Make"></figure></div>


<h3 class="wp-block-heading para">驗證並抓取 Webhook 參數</h3>



<p>(10) 儲存後可以看見一個 webhook 網址，點擊 Copy address to clipboard，將複製出來的網址貼在 Chrome 瀏覽器上，瀏覽器會顯示「Accepted」，回到 Make 畫面會變成 Successfuly determined (下圖右) 就完成 webhook 設定了，這邊可以先將等等要設定的參數以 ? 的方式加在最後面，例如：<mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-cyan-blue-color">https://hook.us1.make.com/xj4.,&#8230;412.4.sf5</mark><strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">?status=hello</mark></strong>，藍色部分是 webhook 網址，紅色部分 status 就是小蛙等一下要傳遞的參數。</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-6 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczPG1TDPxjpd2du9rYFcpUqbpE5kNO0xeJfDp6bSacOm-2MJGGmNW6PfZA9QIbGvBIZsj030rVhqyh_Z_p1Qt5IfOubBV7IwpMa10XZDaM-vP3yUgFE1wa8X44SyozUVzZV6ya3JD2ftKr62ttE6Qycx=w573-h497-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 建立 Webhook 模組" title="IFTTT 收費後的免費替代方案 Make"></figure></div></div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczPs9FctSEpgQK1EIvGYQpulbg-Fb0eUlyDlrvgq0YigC6W2CXvhf6VMrNrZuNblRmdwDpWOVWTlOe_e-Itb3CmIZ3ajk0NWfIskot0fG_MJQt1pqE5KEYRG22jHCd22NxwE8pqeRuLoKy_IFUuBzqmv=w409-h132-s-rw-gm" alt="AP1GczPs9FctSEpgQK1EIvGYQpulbg Fb0eUlyDlrvgq0YigC6W2CXvhf6VMrNrZuNblRmdwDpWOVWTlOe e Itb3CmIZ3ajk0NWfIskot0fG MJQt1pqE5KEYRG22jHCd22NxwE8pqeRuLoKy IFUuBzqmv=w409 h132 s rw gm IFTTT 收費後的免費替代方案 Make" title="IFTTT 收費後的免費替代方案 Make"></figure></div>

<div class="wp-block-image">
<figure class="aligncenter"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczN6eFisblC8q5sbz1C9omcCJNKfl-220QQYQuweNMXqw-LHS63pbZdWjrR5O1lyG-dFMlwIjKaxR3ObKri0--kuFMQZjezOvYXm2DtC2eUfJKDzT8JEeGMDewC7HT_FToVrTM-c6TebXHIhJavrTlxw=w576-h422-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 建立 Webhook 模組" title="IFTTT 收費後的免費替代方案 Make"></figure></div></div>
</div>



<h3 class="wp-block-heading para">建立 LINE 模組</h3>



<p>(11) 點擊 Add another module 新增一個 LINE 通知模組</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczNEjDLrjFvd-jV6dWMYbGJkpw5_m7Wq-4uqG2sS7ysV1oarcJYJpCO58n7jdEHErWegAPvIReHREP48Hic-ZbbbS0oJfrSd72JCAH3-4zqy9DbSuiJuS9ZeQ0EhCeNOGuD9Wq3YLLd1Ie8RP_-yEVXS=w639-h418-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 建立 LINE 模組" style="width:500px" title="IFTTT 收費後的免費替代方案 Make"></figure></div>


<p>(12) 按下新跑出空白模組上大大的 + 後 -> Add another module -> 搜尋並點擊 LINE 模組</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczNe96IROfeKOFwkG_QrFBR_-yBdoud0kmJH4bjrzzRttcpvsG2I0dNxpWjedoUPvjE02kqyQQBm4Edh3rJG1aClOKG7sanHD-lT-cyDmwk9H5X9ySq2hD2vyCwNXMl_VJ_BNhBsunKXGSqbX2FlbeUk=w923-h386-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 建立 LINE 模組" title="IFTTT 收費後的免費替代方案 Make"></figure></div></div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczPM6oxRmgQTkjgYYKg18u_k-nAcLzt3Ju5adaatmDvDAFdj6_Gg99oscmFskBrMK5q0XbSXi14lnkMcpJgHAVaMQ34MJHeZzBKXyO65oX--WiKcJ3YtSlzLYxDGsPqFE3NueTde0M1mAaJV6uh2vyhA=w552-h392-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 建立 LINE 模組" style="object-fit:cover;width:416px;height:auto" title="IFTTT 收費後的免費替代方案 Make"></figure></div></div>
</div>



<p>(13) 選擇 NOTIFY API 下的 Send a Notification</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczMRcCSd_42JNhcihwg5UyYJnKlfJSSoT2roUzDyaj5WhpEk5ssA_NEoky7tIq-fEtjS660Z_Fb_5XdVcjFp-J0em-hftK3mIZzelgir-WFVtodDEoNJ1lRNmto1LpaVebcSel8DSx3QIj-J3uCNWpmU=w564-h651-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 建立 LINE 模組 Send a Notification" style="width:400px" title="IFTTT 收費後的免費替代方案 Make"></figure></div>


<p>(14) 接著跳出建立連線視窗，第一次使用 LINE 模組必須要先建立連線，自行輸入 Connection name</p>


<div class="wp-block-image">
<figure class="aligncenter"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczPB_5A9m4wpqlpROzKqeNYmJzmjgGEMYAOexcXik3WEnW4aGbp8TFaf8ioW-9_QC-OQ_kHDyiJFBfl0IxpPoXNUqnTBW5cx9YBQpy-JUzqHHC3UyBjbn2LtI0_x6pyyQHkeLwUscxCWD8qqfMhQhZQt=w915-h435-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 建立 LINE 模組" title="IFTTT 收費後的免費替代方案 Make"></figure></div>

<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczNoYEKRRxaakI_6TCbdlPnYVz8C7B8z6F0k44lm7mVrFjgVv1Q4wgyJ3dfN472wZgbMlDILtihcHKTQ_mpdGFneslx35IqrNdAL_4Sbrgr8Ww-AVQHsPFw4rrmQwNLgIHYpjSvFrxU-5G_nvqdiK4VL=w576-h476-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 建立 LINE 模組" style="width:400px" title="IFTTT 收費後的免費替代方案 Make"></figure></div>


<p>(15) 登入 LINE 設定與 LINE 連動，下圖右可選擇要使用哪一種通知視窗，可以傳送一對一通知、特定群組或特定聯絡人</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczNhAwY5lmJFVvqltyq3WKHqMm3BGsTFrdN_XdP7qZGYZwI7uzh9z1Ze8EchALI7wi8125HyAi5RwuLcZIg2E4TzSCKYKKMcgV8odskvaByMiNhBt0T8LyN5cbQCij2beGOOusazo-RgzoBpIwxMA7wQ=w642-h724-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 建立 LINE 模組" title="IFTTT 收費後的免費替代方案 Make"></figure></div></div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczOhWD6OlSZVNVbO2yCmwkPBWsURELFwm3LDFri3hmoVzzJNEIAG0li4NV_8INzk5IkNynU9aLTPCemWY5pb7CWWtJEUzDqvEGZJ3ADmkbUGZ-5VcmecMYS7DTDxTAtOtzwuJxQjQOtFaZlNuFTD7vpF=w593-h991-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 建立 LINE 模組" title="IFTTT 收費後的免費替代方案 Make"></figure></div></div>
</div>



<p>完成連動會收到一封 LINE 通知</p>


<div class="wp-block-image">
<figure class="aligncenter"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczP0PsEoTbX_86kTrKlxF7puBK7IIZY-xqSxYRpX79j4DTMYhvd2auN1K2wf739Xnbwjk79kPC27QO3gGh72ZRcq5exAjmgRq8GXrOf48FyB1ZNp0EZ_QJQj1z4_FsYrHuDR4A98q8H3Ko6P_gFDD_hJ=w395-h99-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - LINE 連動完成" title="IFTTT 收費後的免費替代方案 Make"></figure></div>


<h3 class="wp-block-heading para">設定 LINE 模組發送訊息</h3>



<p>(16) 設定 LINE 要發送的訊息，由於上面我們透過 webhook 連結後面加上 <strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">?status=hello</mark></strong>，這邊 Message 點下去的時候，會自動抓取 status 這個參數，之後如果要變更參數的話，加入新參數，例如：?<mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color"><strong>status</strong></mark>=hello<strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-cyan-blue-color">&amp;</mark><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">name</mark></strong>=hans (第二個之後的參數要用 <strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-cyan-blue-color">&amp;</mark></strong> 連接)，再執行一次前面 (10) webhook 連結的步驟，這邊就會可以抓到 status 跟 name 兩個參數了</p>


<div class="wp-block-image">
<figure class="aligncenter"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczMx3fgs1XtxaD_iCFpB7_HPkY8uGD8mQjjWP-PBBEwadvZOj0nWZMPOe2ukKBJRtVFr9Xd-t5hBveZspBvSe9swQSF5ZVhNlGc3C9ZAfeJatHAoQRnWtBjJjdqFMtqV1xstklk1ai-KirvDTZskw3jX=w993-h726-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 建立 LINE 模組" title="IFTTT 收費後的免費替代方案 Make"></figure></div>


<h2 class="wp-block-heading para">完成設定及測試</h2>



<p>(17) 完成後要按儲存才能把這次的 scenario 存下來，將左下方 SCHEDULING 切換成 ON，這個腳本就會開始接收請求囉！</p>


<div class="wp-block-image">
<figure class="aligncenter"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczOohy2LjdBOtsUPVwYauRp5VMdFn8WcbhjbAq1ZQsFk8TaqSTDg_iXnZSVG4Qp1ooAIDZPT6TVFVQt14LA_9ptYJquUa_isA2LxHKoFu6TQP1Lnyh-6vHZ0eMuAFAjkACYabBDulUwR6kHwShgUSs6A=w907-h219-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 排程運作" title="IFTTT 收費後的免費替代方案 Make"></figure></div>


<p>(18) Message 裡面很多變數可以使用，經過小蛙調整，如果訂閱數有變動，會發送 LINE 訊息通知，你也可以根據 Message 內的說明調整發送的訊息</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczOmZfZEkWBn_V8WlIiXULKWMLk9AGi96ShAQYdoAC0l-2eJoWTXzF1rWuakpTZopYck2ks7GlliBYO8mssjndBBl2wzjhPw0YjuzFOMh5Kq88UYk6x0CQRfxf3LzbWPH22udHhActr6Of88heTfNOMv=w568-h780-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 建立 LINE 模組" style="width:400px" title="IFTTT 收費後的免費替代方案 Make"></figure></div>

<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AP1GczP5kuzG3JuzCwTqqzXtDVH6bXjZ7G30jHDfgV9MeOu2bwMC6-oXrPpMD1uNlz65HIRWkMjz37rKSzpOHs2JGzgNi6Ryr6nt0HXvt1_rsqGgHtEh4PLE26UnMqyX7bgHrzkqlKlhfXfwB8NuC3WdQYZW=w403-h125-s-rw-gm" alt="IFTTT 收費後的免費替代方案 Make - 建立 LINE 模組" title="IFTTT 收費後的免費替代方案 Make"></figure></div>


<p>小蛙使用 PHP 來呼叫，如果你有其他可以觸發發送 http request 的工具也同樣可以使用，PHP 程式碼部分如下</p>



<pre class="EnlighterJSRAW" data-enlighter-language="php" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">$url  = 'https://hook.us1.make.com/d................t?status=要傳的參數';
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 15);
$result = curl_exec($curl);
curl_close($curl);</pre>



<p>IFTTT 收費後，如果每個月的 webhook 用量小於 1,000 的話，可以考慮這款免費、可以用來替代 IFTTT 的自動化工具 Make 喔！</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/12721/ifttt-%e6%94%b6%e8%b2%bb%e5%be%8c%e7%9a%84%e5%85%8d%e8%b2%bb%e6%9b%bf%e4%bb%a3%e6%96%b9%e6%a1%88-make/" data-wpel-link="internal">IFTTT 收費後的免費替代方案 Make</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/12721/ifttt-%e6%94%b6%e8%b2%bb%e5%be%8c%e7%9a%84%e5%85%8d%e8%b2%bb%e6%9b%bf%e4%bb%a3%e6%96%b9%e6%a1%88-make/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>1 招解決 Hyper-V 虛擬機器無法開機</title>
		<link>https://noter.tw/11781/hyper-v-%e8%99%9b%e6%93%ac%e6%a9%9f%e5%99%a8%e7%84%a1%e6%b3%95%e9%96%8b%e6%a9%9f/</link>
					<comments>https://noter.tw/11781/hyper-v-%e8%99%9b%e6%93%ac%e6%a9%9f%e5%99%a8%e7%84%a1%e6%b3%95%e9%96%8b%e6%a9%9f/#respond</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Tue, 20 Jun 2023 10:00:57 +0000</pubDate>
				<category><![CDATA[技術相關]]></category>
		<category><![CDATA[虛擬機器黑屏的解決方案]]></category>
		<category><![CDATA[光碟開機]]></category>
		<category><![CDATA[虛擬化技術問題]]></category>
		<category><![CDATA[虛擬機器無法開機解決方法]]></category>
		<category><![CDATA[Hyper-V無法啟動]]></category>
		<category><![CDATA[Hyper-V無法運行的解決辦法]]></category>
		<category><![CDATA[Hyper-V開機錯誤]]></category>
		<category><![CDATA[虛擬機器無法進入操作系統的解決方法]]></category>
		<category><![CDATA[Linux Live CD]]></category>
		<category><![CDATA[Hyper-V虛擬機器]]></category>
		<category><![CDATA[虛擬機器故障解決方案]]></category>
		<category><![CDATA[虛擬機器故障排除]]></category>
		<guid isPermaLink="false">https://noter.tw/?p=11781</guid>

					<description><![CDATA[<p>小蛙之前有一些 Ubuntu 的服務跑在 Hyper-V 的虛擬機器上，之前有印象空間快滿了，昨天去看的時候已經沒辦法啟動了 ... 這篇文章記錄若遇到 Hyper-V 虛擬機器無法開機的狀況時，透過 Linux 安裝光碟進入到虛擬機器內把必要的東西複製出來，或是清出空間來開機。</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/11781/hyper-v-%e8%99%9b%e6%93%ac%e6%a9%9f%e5%99%a8%e7%84%a1%e6%b3%95%e9%96%8b%e6%a9%9f/" data-wpel-link="internal">1 招解決 Hyper-V 虛擬機器無法開機</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>小蛙之前有一些 Ubuntu 的服務跑在 Hyper-V 的虛擬機器上，之前有印象空間快滿了，昨天去看的時候已經沒辦法啟動了 &#8230; 這篇文章記錄若遇到 Hyper-V 虛擬機器無法開機的狀況時，透過 Linux 安裝光碟進入到虛擬機器內把必要的東西複製出來，或是清出空間來開機。</p>



<span id="more-11781"></span>



<h2 class="wp-block-heading para">什麼是 Hyper-V 虛擬機器？</h2>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>Hyper-V是Microsoft Windows作業系統中的一項虛擬化技術，它允許在單一主機上運行多個虛擬機器（VMs）。Hyper-V虛擬機是在主機操作系統之上建立的獨立環境，每個虛擬機器都具有自己的作業系統、應用程式和資源。</p>



<p>Hyper-V提供了虛擬化平台，可在Windows Server和某些Windows工作站版中使用。它是一個基於類型-1（bare-metal）架構的虛擬化解決方案，這意味著它直接在硬體上運行，而不需要額外的操作系統。這使得虛擬機器能夠更高效地運行，並提供接近原生性能的效能。</p>
<cite><a href="https://chat.openai.com/chat" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">ChatGPT<span class="wpel-icon wpel-image wpel-icon-6"></span></a><em> 產生</em></cite></blockquote>



<p>嗯嗯，Hyper-V 就是這麼回事，另外還有 VMware vSphere、Oracle VM VirtualBox &#8230; 等類似的工具提供相關虛擬機器 (Virtual Machine) 的功能。</p>



<h2 class="wp-block-heading para">Hyper-V 虛擬機器無法開機</h2>



<p>小蛙這次遇到的問題是虛擬機器 (Virtual Machine，以下簡稱 VM) 儲存空間爆了，造成 Hyper-V 沒辦法正常重啟 VM，一開始不知道怎麼辦胡亂設定了一通，結果讓 VM 完全整個無法啟動 &#8230; 原本放在 VM 裡面的資料也拿不出來 Orz &#8230;</p>



<p>後來想到以前 Windows 掛掉沒辦法開機的時候，可以使用類似 NoName XPE 的工具，把作業系統跑在光碟上或是隨身碟上，並且包含了許多修復工具，透過這種方式來修復原本出問題的作業系統，Linux 早期也有聽過 Live CD，如果以 Live CD 使用光碟機開機，就能將不能開機的 VM 空間清出來，或是把資料 copy 出來了。</p>



<h2 class="wp-block-heading para">Live CD 解決方案</h2>



<p>以小蛙的狀況為例，使用的作業系統是 Ubuntu 20.04 Desktop 版本，首先必須要先到 Ubuntu 官網下載 ISO 映像檔，接著進入 Hyper-V，在無法開機的 VM 點擊滑鼠右鍵 -&gt; 設定</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AJFCJaWSWBf4I7ekYXJnxSSaCr2k3dCWuPUMmp5DzNd7crPCmfYEyH5blavTicLkywGPKX-5yJONUWxTTxFxfSzH8uYLhKiNgZbYzfH14fKUUsanX0EjJsVR5O6z4Faj4rNHwbxBMDSwKP5iBPvzcodpZXvb=w229-h327-s-no?authuser=5" alt="Hyper-V 虛擬機器無法開機 1" width="172" height="245" title="1 招解決 Hyper-V 虛擬機器無法開機"></figure></div>


<p>左側切換到 SCSI 控制器，選擇 DVD 光碟機後，點擊右下角新增</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img fetchpriority="high" decoding="async" src="https://lh3.googleusercontent.com/pw/AJFCJaWQc7Q8C8bDZjqmaGIKL9ytSjmRyZZnzs67s4bS_8v8iHEtwiUcVBeRefQLRirNpJMMWCuXN-dvU10pF37FLRvvb4tmnJkCwfgzAzWgfVFT82O_V4LR3gdIYCnnYIct-XmS7ugFYGH0snD4ngyqpZRJ=w1155-h446-s-no?authuser=5" alt="Hyper-V 虛擬機器無法開機 2" width="578" height="223" title="1 招解決 Hyper-V 虛擬機器無法開機"></figure></div>


<p>選擇剛剛下載的映象檔後儲存設定</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AJFCJaVJ_Se--PuTeupQ0F7qDVbbxR89fVyYzSDoMGkIYQI-5wMmlrf_q03VSCkwNSsM9S9MeCNyWSCt7Vt1vbDe0sCrnN0b3GUwoX4qUVj17bjvaTUxzoOnBYrQC6wZc0l-UQVwXCWi8ocCoPMWKUIjrW3j=w1151-h443-s-no?authuser=5" alt="Hyper-V 虛擬機器無法開機 3" width="576" height="222" title="1 招解決 Hyper-V 虛擬機器無法開機"></figure></div>


<p>接著到左側韌體，將 DVD 光碟機移動到最上面，儲存後啟動 VM</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AJFCJaXF1RQcSbzBvD2f6htZEEUSnNT9T1hWuDUp9DhCvWd0nfUcmcw7SGGFpwuO03qDIsM7ceYhNmVNfolpjLSxSot_1ldlRf1h6k9x66bumV3ggqh92PJeNy-uEnTF8fElK8DyU5S-59uqzK7B9pN-dvts=w1112-h440-s-no?authuser=5" alt="Hyper-V 虛擬機器無法開機 4" width="556" height="220" title="1 招解決 Hyper-V 虛擬機器無法開機"></figure></div>


<p>若以上設定成功，開機後會見到以下畫面，選擇中文(繁體) -&gt; 試用 Ubuntu</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AJFCJaU1bmIurPZ25xF9zzU567oOJaREfbciT-q7RPj5MZDUyQBLyXaiv6hhP7oSYdi-Uv6nxJGbIdr3VRYRSKdeDZhOGwRar-TAYJQWHouA9pYrrWTD6pkQNipus7uzl6ssv9_KGwiaXXEAIfw6lrJUBXzp=w901-h730-s-no?authuser=5" alt="Hyper-V 虛擬機器無法開機 5" width="451" height="365" title="1 招解決 Hyper-V 虛擬機器無法開機"></figure></div>


<p>等待一下下就進到 Ubuntu 桌面囉</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AJFCJaWAYBwJOuzwBp7T5EXUoZPecFkepDjIooR0BN_nBNv9alXboSVEtRl3QtI5UJdzVfxVJfjMEWBZy9PrwlTAGLPyGBItsv069DnIEj30K7taBF87fX_aYmBp0pYePCN3yhQMXOHSh5eeQ8nrccVi0r9m=w1053-h788-s-no?authuser=5" alt="Hyper-V 虛擬機器無法開機 6" width="527" height="394" title="1 招解決 Hyper-V 虛擬機器無法開機"></figure></div>


<p>點擊左下角查看所有程式，找到 Disks 磁碟管理工具</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AJFCJaXSI_5SH3PoT1dwgsJQPda-4SoQbWmkkzKdym40OrpfMgr4K7-twLC0WLzbFJGq8WEkBEK1WMj5rfXteFC-FRF32AcOTJ85gkFB9JNGLte943MOVIYmBo331MQpNfwM2vnUOko00akr6PKbIHsWgiBL=w1052-h786-s-no?authuser=5" alt="Hyper-V 虛擬機器無法開機 7" width="526" height="393" title="1 招解決 Hyper-V 虛擬機器無法開機"></figure></div>


<p>左側選取 VM 使用的硬碟，右邊選取正確的磁區後，點擊像播放鍵的按鈕將硬碟掛載起來</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AJFCJaW5ih80cS7J2a9FRDMFswd34Br4KGGl6Q14uPVUKZoWfbpsWvMnalVkeBY37OZqwVOaB_r91S6zVYbP1NGym-RPwCHgRavOK2sXJOVd-W9YV1Qn_R5WmS5aJO0gJk4MteOjiG0U6D6rAtqCH6gD8KQf=w977-h537-s-no?authuser=5" alt="Hyper-V 虛擬機器無法開機 8" width="489" height="269" title="1 招解決 Hyper-V 虛擬機器無法開機"></figure></div>


<p>掛載完成會看到播放鍵變成停止鍵了，同時最下面可以看到硬碟掛載的路徑</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AJFCJaXQ8-lhghkZT-HAbV4Jee78WOAyJrtQdnvpH1IJ1XJR7Kaq6EUDUTkvsGhfZJaiLgtJlS0m6Uzv_L6GG076f9CixKTh9xvgLrnXmGBaJZh16sD9cPEi-Wva1_BF2Xop9oh_SDGlvSdcP1ucPaovtXdO=w971-h509-s-no?authuser=5" alt="Hyper-V 虛擬機器無法開機 9" width="486" height="255" title="1 招解決 Hyper-V 虛擬機器無法開機"></figure></div>


<p>開啟 Terminal，輸入 sudo su 切換成 root 使用者，再進到掛載的目錄 /media/ubuntu/desktop-rootfs/ 就可以把 VM 裡的檔案複製出來或是清裡不必要的檔案挪出空間囉！</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AJFCJaWS2Xilnz1WEL8v6r9ejY898NoDfz_Yam6qOr180KLj5v04lfEOjNeYTKlv3ujAmAhEL5EQShTNZ4nN7_X6ONiB6tonbsyWaqrQueGupt7kaKRktSiOnMHY90V9in5AGGSSChuTF9fmbsTnHaUKreW6=w765-h505-s-no?authuser=5" alt="Hyper-V 虛擬機器無法開機 10" width="574" height="379" title="1 招解決 Hyper-V 虛擬機器無法開機"></figure></div>


<p>其他<a href="https://noter.tw/share/tech/" data-wpel-link="internal">技術相關文章</a>。</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/11781/hyper-v-%e8%99%9b%e6%93%ac%e6%a9%9f%e5%99%a8%e7%84%a1%e6%b3%95%e9%96%8b%e6%a9%9f/" data-wpel-link="internal">1 招解決 Hyper-V 虛擬機器無法開機</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/11781/hyper-v-%e8%99%9b%e6%93%ac%e6%a9%9f%e5%99%a8%e7%84%a1%e6%b3%95%e9%96%8b%e6%a9%9f/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>1 招解決「因為應用程式的並列設定不正確，所以無法啟動 Chrome 問題修正」</title>
		<link>https://noter.tw/11092/%e6%87%89%e7%94%a8%e7%a8%8b%e5%bc%8f%e7%9a%84%e4%b8%a6%e5%88%97%e8%a8%ad%e5%ae%9a%e4%b8%8d%e6%ad%a3%e7%a2%ba/</link>
					<comments>https://noter.tw/11092/%e6%87%89%e7%94%a8%e7%a8%8b%e5%bc%8f%e7%9a%84%e4%b8%a6%e5%88%97%e8%a8%ad%e5%ae%9a%e4%b8%8d%e6%ad%a3%e7%a2%ba/#respond</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Tue, 14 Mar 2023 01:28:34 +0000</pubDate>
				<category><![CDATA[技巧分享]]></category>
		<category><![CDATA[技術相關]]></category>
		<category><![CDATA[sxstrace.exe]]></category>
		<category><![CDATA[因為應用程式的並列設定不正確，所以無法啟動，如需詳細資訊，請參閱應用程式事件記錄檔，或使用命令列工具 sxstrace.exe]]></category>
		<category><![CDATA[Chrome]]></category>
		<category><![CDATA[Chrome 打不開]]></category>
		<category><![CDATA[Chrome 問題]]></category>
		<category><![CDATA[並列設定不正確]]></category>
		<guid isPermaLink="false">https://noter.tw/?p=11092</guid>

					<description><![CDATA[<p>因為應用程式的並列設定不正確，所以無法啟動，如需詳細資訊，請參閱應用程式事件記錄檔，或使用命令列工具 sxstrace.exe。有天同仁電腦一開機就遇到這個錯誤，上網查了一些解決方法，要下載這個下載那個補充檔案，檢查路徑有的沒的，超級麻煩，但其實解決方法很簡單。</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/11092/%e6%87%89%e7%94%a8%e7%a8%8b%e5%bc%8f%e7%9a%84%e4%b8%a6%e5%88%97%e8%a8%ad%e5%ae%9a%e4%b8%8d%e6%ad%a3%e7%a2%ba/" data-wpel-link="internal">1 招解決「因為應用程式的並列設定不正確，所以無法啟動 Chrome 問題修正」</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p><strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">因為應用程式的並列設定不正確，所以無法啟動，如需詳細資訊，請參閱應用程式事件記錄檔，或使用命令列工具 sxstrace.exe</mark></strong>。有天同仁電腦一開機就遇到這個錯誤，上網查了一些解決方法，要下載這個下載那個補充檔案，檢查路徑有的沒的，超級麻煩，但其實解決方法很簡單。</p>



<span id="more-11092"></span>



<p>想說直接再安裝一次 Chrome 搞不好就好了，再次上網確認重新安裝一次會不會有問題，有不少文章介紹可以直接重新安裝，不用把原本的 Chrome 移除，原本的設定之類的也不會遺失，遇到此問題的朋友不用再去試其他方法了，再安裝一次 Chrome 讓安裝檔自己修復這個問題，重新安裝完之後再次開啟 Chrome，一切就正常囉！</p>



<p>Chrome 下載連結：<a href="https://www.google.com/intl/zh-TW/chrome/" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">https://www.google.com/intl/zh-TW/chrome/<span class="wpel-icon wpel-image wpel-icon-6"></span></a></p>



<p>最後分享一下 <a href="https://noter.tw/104/%e5%a5%bd%e7%94%a8%e7%9a%84-chrome-%e6%8f%92%e4%bb%b6%e6%8e%a8%e8%96%a6/" data-wpel-link="internal">好用的 Chrome 插件推薦</a>。</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/11092/%e6%87%89%e7%94%a8%e7%a8%8b%e5%bc%8f%e7%9a%84%e4%b8%a6%e5%88%97%e8%a8%ad%e5%ae%9a%e4%b8%8d%e6%ad%a3%e7%a2%ba/" data-wpel-link="internal">1 招解決「因為應用程式的並列設定不正確，所以無法啟動 Chrome 問題修正」</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/11092/%e6%87%89%e7%94%a8%e7%a8%8b%e5%bc%8f%e7%9a%84%e4%b8%a6%e5%88%97%e8%a8%ad%e5%ae%9a%e4%b8%8d%e6%ad%a3%e7%a2%ba/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Google 試算表寄送大量郵件，每天免費 100 封</title>
		<link>https://noter.tw/10751/google-%e8%a9%a6%e7%ae%97%e8%a1%a8%e5%af%84%e9%80%81%e5%a4%a7%e9%87%8f%e9%83%b5%e4%bb%b6%e6%af%8f%e5%a4%a9%e5%85%8d%e8%b2%bb-100-%e5%b0%81/</link>
					<comments>https://noter.tw/10751/google-%e8%a9%a6%e7%ae%97%e8%a1%a8%e5%af%84%e9%80%81%e5%a4%a7%e9%87%8f%e9%83%b5%e4%bb%b6%e6%af%8f%e5%a4%a9%e5%85%8d%e8%b2%bb-100-%e5%b0%81/#respond</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Sat, 31 Dec 2022 16:16:38 +0000</pubDate>
				<category><![CDATA[技巧分享]]></category>
		<category><![CDATA[免費資源]]></category>
		<category><![CDATA[軟體、工具]]></category>
		<category><![CDATA[技術相關]]></category>
		<category><![CDATA[電子郵件自動化工具]]></category>
		<category><![CDATA[Mail Merge Attachments]]></category>
		<category><![CDATA[電子郵件營銷技巧]]></category>
		<category><![CDATA[Apps Script]]></category>
		<category><![CDATA[Google 試算表郵件群發]]></category>
		<category><![CDATA[Mail Merge for Batch Email]]></category>
		<category><![CDATA[電子郵件自動化策略]]></category>
		<category><![CDATA[bulk email]]></category>
		<category><![CDATA[Google 試算表寄送郵件]]></category>
		<category><![CDATA[電子郵件大量寄送]]></category>
		<category><![CDATA[每天免費寄送 100 封郵件]]></category>
		<category><![CDATA[Google 試算表]]></category>
		<category><![CDATA[自動化郵件寄送]]></category>
		<category><![CDATA[Google Sheets]]></category>
		<category><![CDATA[電子郵件市場行銷]]></category>
		<category><![CDATA[電子郵件群發]]></category>
		<category><![CDATA[attachments]]></category>
		<guid isPermaLink="false">https://noter.tw/?p=10751</guid>

					<description><![CDATA[<p>延續前幾篇大量寄送不同內容 Email 給個別使用者的主題，這篇文章介紹如何使用 Apps Script，透過 Google 試算表寄送大量郵件，每天免費限額為 100 封，初次設定上會比前面的方法複雜些。</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/10751/google-%e8%a9%a6%e7%ae%97%e8%a1%a8%e5%af%84%e9%80%81%e5%a4%a7%e9%87%8f%e9%83%b5%e4%bb%b6%e6%af%8f%e5%a4%a9%e5%85%8d%e8%b2%bb-100-%e5%b0%81/" data-wpel-link="internal">Google 試算表寄送大量郵件，每天免費 100 封</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>延續前幾篇大量寄送不同內容 Email 給個別使用者的主題，這篇文章介紹如何使用 Apps Script，透過 Google 試算表寄送大量郵件，每天免費限額為 100 封，初次設定上會比前面的方法複雜些。</p>



<span id="more-10751"></span>



<p>若想使用 Word + Excel + Outlook 發信 (無附加檔案功能) 可參考 <a href="https://noter.tw/10739/word-mail-merge-send-by-outlook/" data-wpel-link="internal">Word 合併列印使用 Outlook 發送郵件</a>，使用現成的擴充功能 &gt; 外掛程式 (較簡單但每日限 50 封) 發送信件及附加檔案可參考 <a href="https://noter.tw/10744/google-sheets-email-yet-another-mail-merge-mail-merger-for-gmail-yamm/" data-wpel-link="internal">Google 試算表批量發送 Email (免費版每日 50 封) – 使用 Yet Another Mail Merge: Mail Merger for Gmail (YAMM)</a></p>



<p>Google 為避免濫用，針對使用 Apps Script 發信設定了限額，一般免費版的 Google 帳號每日發送限額是 100 封，如果是 Google Workspace 帳戶的話，每日發送限額提升到 1,500 封喔！</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEWai8Qsu2x8xW9cl4rFAZAEkFD2j86EVl1xgKxHiHusDAbu1-g9oHbn4dcLLzxBl08k1uZtzUSzWE2w_I0Pfw6wevanTN9f-YhwdUI7STgED7Yy-88K83jhP96ztxt-h719ovVwST3dy41ZPLLhz_93=w1561-h602-no?authuser=2" alt="Google Workspace 各項功能限額" width="781" height="301" title="Google 試算表寄送大量郵件，每天免費 100 封"></figure></div>


<h2 class="para wp-block-heading">什麼是 Apps Script</h2>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>Apps Script 是一種用於建立和管理 Google Workspace 應用程式（原名 Google Apps）的編程平台。它基於 JavaScript 語言，可以讓您自定義 Google Workspace 應用程式的功能，或者建立新的應用程式。<br><br>Apps Script 可以用於各種 Google Workspace 應用程式，包括 Gmail、Google 表單、Google 文檔、Google 工作表和 Google 地圖等。例如，您可以使用 Apps Script 自動化電子郵件傳送流程，或者在 Google 表單中添加自定義功能。</p><cite><a href="https://chat.openai.com/chat" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">ChatGPT<span class="wpel-icon wpel-image wpel-icon-6"></span></a> 產生 (無法保證資訊正確性)</cite></blockquote>



<p>感謝 ChatGPT 大師，由此可知透過 Google 試算表也可以使用 Apps Script 來進行自動化電子郵件傳送寄送。</p>



<h2 class="para wp-block-heading">Mail Merge for Batch Email</h2>



<p>今天要使用的 <a href="https://sites.google.com/view/isaac2016sharing/home?authuser=0" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">Mail Merge for Batch Email<span class="wpel-icon wpel-image wpel-icon-6"></span></a> 是一位香港老師所開發，並在網路上分享 (超佛)，將 Apps Script 處理發送電子郵件的相關功能寫在 Google 試算中，只要透過「建立副本」就可以將整個功能複製回自己的 Google 雲端硬碟，超級方便。</p>



<p>小蛙寫這篇文章的時候版本來到 8.02，不過實際操作的時候 8.02 卻不斷出現問題，因此這篇會以前一版 7.00 為主。</p>



<h2 class="para wp-block-heading">建立 Google 試算表副本</h2>



<p>連到 <a href="https://sites.google.com/view/isaac2016sharing/mail-merge-for-batch-email" target="_blank" rel="noopener nofollow external noreferrer" data-wpel-link="external" class="wpel-icon-right">這裡<span class="wpel-icon wpel-image wpel-icon-6"></span></a> 開啟 Google 試算表，小蛙使用的是 v7.00 (原本使用 v8.02 但一直失敗)</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEUSH8MeL9jZXpPB8k6nnBQ9aLddlD7CJHVJr51JCcMYJAlG-4TRM1XkLdsckHlHqlaiY7MKFM8YL3jO_fbI0fVogvIQzNodi1nuvu6UTaSLQcuLHhawOT0AAjNA_Uq_KETN4NTpEsYx3RRp1aGEe2zC=w2324-h900-no?authuser=2" alt="Mail Merge for Batch Email 1" title="Google 試算表寄送大量郵件，每天免費 100 封"></figure></div>


<p>進入後會看到以下畫面，點擊「建立副本」就把這個發送大量郵件的強大功能複製到自己的雲端硬碟了，接下去看後續設定。</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEV8JeGjL8cXIVC1uTBOpS1VeVZJg96v0MvEaoPprHVUclqXWhZoji4FK4eVb0KJIsV5ZEh8eK5FNGy5s13zhy0cZQV1TEtt5dR0b2ijXaSNOgOZR1sJbdYBPw9Mk2xzi0ZjgZ-lrsOPWmfQdZRMBCz9=w1334-h694-no?authuser=2" alt="Mail Merge for Batch Email 2" width="667" height="347" title="Google 試算表寄送大量郵件，每天免費 100 封"></figure></div>


<h2 class="para wp-block-heading">建立 Google 試算表副本</h2>



<p>第一次開啟時，頂端工具列最右邊 (說明旁邊) 應該要出現 Mail Merge for Batch Email，如果畫面跟下圖一樣的話，就典籍「擴充功能」-&gt;「Apps Script」</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEV9WUi4wIsDf3j-HKvrv40VaUXU_Mj7IRXLUKav2k7vWIhCwpv93plSVvYhstJh6vKAm45raz4Ak12MnzQTY1wAeLOYo2t8734kDWST7lNXZ5J_CuWTbUrfegvJPOYZtEQl9DaYpaK1VCIIHj2eJa-j=w1382-h460-no?authuser=2" alt="Mail Merge for Batch Email 3" width="691" height="230" title="Google 試算表寄送大量郵件，每天免費 100 封"></figure></div>


<p>直接點擊「執行」，由於 Apps Script 使用到特殊權限，基於安全性的理由，需要由使用者接受這些權限之後才可以繼續下去</p>



<div class="wp-block-columns are-vertically-aligned-center is-layout-flex wp-container-core-columns-is-layout-9 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:66.66%"><div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEUKHO5Zhe7CU9A4I-WROPFjlfR4rm6Zc3_nsFYBFO6x02P4xej9ty_qEICp5qyws3dAyJ9P4N3l1UmXOcPsyXyIUseAB63kkcfvt9OyOUj0SJZUzKtcoPaww6wpELoOYvmoQYKGS6wTuwieS1Tbtiho=w1753-h884-no?authuser=2" alt="Mail Merge for Batch Email 4" title="Google 試算表寄送大量郵件，每天免費 100 封"></figure></div></div>



<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:33.33%"><div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEX6qCDv_1pvLmNjx3Wr8jY1JVISVx-oAhll_XlcXRjGdF4dyXCFelrWojuXmKi4NCHMXNbb_uHbcq4zKDsRW4TGUpPurjkIY8HHkL21ctl6l_MS749pS2zS77HZeQStmRIyh1bPXpPnfjkpJWpBZxzB=w581-h331-no?authuser=2" alt="Mail Merge for Batch Email 5" title="Google 試算表寄送大量郵件，每天免費 100 封"></figure></div></div>
</div>



<div class="wp-block-columns are-vertically-aligned-center is-layout-flex wp-container-core-columns-is-layout-10 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:33.33%"><div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEX7fV9A_zqvmjRBRrfDKYbfZ-5t5O7DIwADyvchAQuBe29OjAQOKdfDNHVTt2qugC6i-UeqP-zLmYqwYhAl9d9Rk8e3QdsXGDqm_-TA3hiHLwo4JrFfFnzk6Yqv2moArTSP7V8Evh8mfXHl1ZnYj_sZ=w954-h1052-no?authuser=2" alt="Mail Merge for Batch Email 6" title="Google 試算表寄送大量郵件，每天免費 100 封"></figure></div></div>



<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:66.66%"><div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEU1TQ4vkTgdvO3vYwW84j-Btdfv1L4TbU1jtsK1xKENr_t8s-xF0fWOGtIQhLQP_B5xpNIeuIjo_z2Zw-5kpIr2hzYDAKigiEld3iHFe7dDdw6Hzh_De1sIsR6FXlr7_TgY8J7-4ah9gzFEZ56Peb9D=w1259-h824-no?authuser=2" alt="Mail Merge for Batch Email 7" title="Google 試算表寄送大量郵件，每天免費 100 封"></figure></div></div>
</div>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-11 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:33.33%"><div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEXAxd48B3e667wkIRMgW4g3qllDVjbAgmFJAYmkX00dOvLO78OqhvnkrP6ONTZxU35G5KpidV0K-JUDtsj4Mv9Us369D-xZN_KVKZfMEsNSoNHc8QF6VzHOsoPOW-YJlXf2EneBZ9s87jqCi1p5cXX1=w933-h1415-no?authuser=2" alt="Mail Merge for Batch Email 8" title="Google 試算表寄送大量郵件，每天免費 100 封"></figure></div></div>



<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:66.66%"><div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEWQUMExadeUf_Z99HJ0xXC6pyEs1LvmJYk5M9NlQ-xw_7fXSgaFoL0jj0HIm-2NksHTE6UTGhvOgKHClhmsjAQUiloOnWNGvKhP71Nsz3W6USSJwsOjETZFWUYFFTim0WMzxEUH91C-b5IxnKG0242L=w1530-h690-no?authuser=2" alt="Mail Merge for Batch Email 8" title="Google 試算表寄送大量郵件，每天免費 100 封"></figure></div></div>
</div>



<p>出現執行完畢，沒有出現任何錯誤後，回到 Google 試算表可以看到多出 Mail Merge for Batch Email 選單</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEWRS2IvQ64aI4ykxf4eUGmRZ46fU3wP6cn_h0hyvhizhUOOi31hBleUf2SnI1ds-gBjK1G2cmO59m_9V8q-T02HXAMMWsXsBW5TNj-aiUysMbDYTKTU2AXVM91Z7iOQ0dtCbVtg7Kk1EwIqbKQRaS8A=w596-h253-no?authuser=2" alt="Mail Merge for Batch Email 9" width="298" height="127" title="Google 試算表寄送大量郵件，每天免費 100 封"></figure></div>


<h2 class="para wp-block-heading">設定附件資料夾 ID</h2>



<p>如果要使用到附加檔案的話，有兩個方法，先介紹第一個：透過 Mail Merge for Batch Email -&gt; Pick Folder for Attachment 選取</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEWksATn5B01IhSAUiKfYIFybUreqc1CcOvejps2XA8LzhiGJ8-SIU18BtyToPMCMIdAd2ViHsdWfJvVi2paHvNgSkweJkTwjDcn-sK12B_FnOOXlnAJ42AVVe7DxLDdxnsSIGc4e8A6gB3_-vYe_yFF=w888-h524-no?authuser=2" alt="Mail Merge for Batch Email 10" width="444" height="262" title="Google 試算表寄送大量郵件，每天免費 100 封"></figure></div>


<p>小蛙把要夾帶的檔案都存放在 Goolge 雲端硬碟 &gt; 證書 資料夾中，從下拉選單中選擇「證書」資料夾後，點擊 Pick This Folder </p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-12 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEWnujpUUK4utPTt8dtwv7f4FwMnpzyDG0-2wKLYi9xBHbRWhIpF9y55cKl1JwQbkK08sELxbMJnoW7l4xO1-BJdY6kw0vHOmKveSjBI41Hi42s5ryWrHCEnIa2jK6eQEMy57HZRjxS4deTie72GsGNR=w616-h648-no?authuser=2" alt="Mail Merge for Batch Email 11" title="Google 試算表寄送大量郵件，每天免費 100 封"></figure></div></div>



<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEVUFWMT-sAwawmMLovPlCQFGNugK2DYOolY3G_1FVv75EFlFOBGqbXGJ0fiXU1_fr7p6lbTcWo0SyK6NjVR9QmclGwdShGF47-q2ZEOzFO8ugLY9hakBKpK_aVolQCTND6R2cRVZDFQkeUNgElxFCct=w600-h539-no?authuser=2" alt="Mail Merge for Batch Email 12" title="Google 試算表寄送大量郵件，每天免費 100 封"></figure></div></div>
</div>



<p>選擇完成後會發現 Settings 頁籤內的 Folder ID 欄位自動填入值</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEWKS83OKT0o0QhkMLn72oX3CrsKCnu4-4LiO8pgfdjTJmVZnt4Y7-2ZlMf-JBPVgXs24yPxTE-vt1W8W1giZ4cueoZMAja0rNWY_gtmGumtM1FBAzebm1B5D3DWgJ8-6xjRDEh5pla188wNgiYdUtIC=w2298-h444-no?authuser=2" alt="Mail Merge for Batch Email 13" title="Google 試算表寄送大量郵件，每天免費 100 封"></figure></div>


<p>第二個方法不透過該選單，而是直接開啟存放附加檔案的資料夾後，從網址列複製 (/folders/<strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">複製這邊</mark></strong>)，接著貼進同上圖的位置</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEU6h7zbhIv14ADvX8iiLKpF0CrHXuk88KKouYP-1pAYglKh5_BJY6Xi3-aJyVnuohUTYGrNBcv7IrsAmdig4mi8cXBYDn6UW8MTsH889aRXyEdATpPJfdho9cQP9cBQhD5yGbRrpeoxa5tcexo7yCw0=w1394-h730-no?authuser=2" alt="Mail Merge for Batch Email14" width="697" height="365" title="Google 試算表寄送大量郵件，每天免費 100 封"></figure></div>


<h2 class="para wp-block-heading">設定 DataSheet 收件人資料</h2>



<p>繼續使用之前的範例，小蛙希望寄送的郵件內容是</p>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">黃小蛙 先生 您好：

感謝您參加 Google 研習，附件為您的證書。

記下來 敬上</pre>



<p>首先切換到 DataSheet 頁籤，黃底欄位的表頭（To Send, Done, Email Address, Template, Attachment List, SubFolder）<mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color"><strong>不可以修改，也不可以把欄位刪除</strong></mark>，其他白底的欄位才是自己可以刪除調整的，小蛙把所有原本有的欄位都刪掉，只留下自己要的 Name、Title 跟 Event。Attachment List 填入小蛙要附加的檔案 s0001.png 及 s0002.png</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEUdrwSfysrZv8IR44SuVUhjqAnX7oJrvJHwx05k37ZcywQ3TPYsJX_QpN1F3mxSrrUGDa5JA_oZhPhbPfUAFz3d2utkl2M4SpIac_NtA8Wa-YRjYuhQOBKh1w2J18ntJGIVhDip1oO10S30xeDViA_c=w1755-h235-no?authuser=2" alt="Mail Merge for Batch Email 15" title="Google 試算表寄送大量郵件，每天免費 100 封"></figure></div>


<p>欄位說明如下：</p>



<ul class="my-li bg-darkblue wp-block-list"><li>To Send：是否要發送郵件。如果不要的話改成 no。</li><li>Done：發送完成時顯示發送狀態。</li><li>Email Address：收件者 Email。</li><li>Template：要使用哪個範本發送。</li><li>Attachment List：要附加的檔案。</li><li>SubFolder：附加檔的子目錄，若上述 Folder ID 下還有子目錄的話，可以輸入在這邊。</li><li>Name：姓名，自訂變數。</li><li>Title：頭銜，自訂變數。</li><li>Event：活動名稱，自訂變數。</li></ul>



<h2 class="para wp-block-heading">設定 Settings 寄件資料</h2>



<ul class="my-li bg-darkblue wp-block-list"><li>Cc：電子郵件副本，若有多個可用 , 分隔。</li><li>Bcc：電子郵件密件副本，若有多個可用 , 分隔。</li><li>Folder ID：附加郵件在雲端硬碟的 id，前面的步驟已設定。</li><li>Send as：寄件者名稱。</li><li>Replay to：收件者回覆的信箱。</li><li>No replay：是否允許回覆。</li></ul>



<p>依自己的狀況填寫，CC 及 BCC 若沒有的話可以留空白，其他的請填寫正確</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEWKS83OKT0o0QhkMLn72oX3CrsKCnu4-4LiO8pgfdjTJmVZnt4Y7-2ZlMf-JBPVgXs24yPxTE-vt1W8W1giZ4cueoZMAja0rNWY_gtmGumtM1FBAzebm1B5D3DWgJ8-6xjRDEh5pla188wNgiYdUtIC=w2298-h444-no?authuser=2" alt="Mail Merge for Batch Email 16" title="Google 試算表寄送大量郵件，每天免費 100 封"></figure></div>


<h2 class="para wp-block-heading">設定 Template1 郵件範本</h2>



<p>這部份原始範例可能會比較混亂一點，不過可以跟小蛙一樣先把內容刪除，再自己一個一個填入，我們先不管粗體、斜體、底線、清單 &#8230; 等 Markdown 的語法，把 Subject 跟 Body 先填好，例如：小蛙的主題是「感謝您參加 Google 研習」，因為上面小蛙把參加的活動設定為變數 Event，因此把「感謝您參加 Google 研習」改成「感謝您參加 ${&#8220;Event&#8221;}」，以此類推，其他部份如「黃小蛙 先生 您好：」就會變成「${&#8220;Name&#8221;} ${&#8220;Title&#8221;} 您好」。</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEUW3cnJPcBIpnTPM_wi5Effrp1FKq4_wefHol49riM_QT9dduSYBHhxakmhvP1XCO9Jg5DPWPPOm7jadA-tq3CN0ZezFoeUWxijDN1OLQKEZ074Ogp9toY3KPv6Nke4rSwXjF2bPROfr2uzKByH1tIr=w2305-h641-no?authuser=2" alt="Mail Merge for Batch Email 17" title="Google 試算表寄送大量郵件，每天免費 100 封"></figure></div>


<p>再來 Markdown 呈現的部份則有</p>



<ul class="my-li bg-darkblue wp-block-list"><li><em>斜體</em>：用單個 * 包起來，例如：*這裡會變成斜體*</li><li><strong>粗體</strong>：用兩個 * 包起來，例如：**這裡會變成斜體**</li><li><span style="text-decoration: underline;">底線</span>：用兩個 _ 包起來，例如：__這裡會變成斜體__</li><li>條列：用數字及 . 條列，例如：1. xxxx 2. oooo</li><li>項目：用 * &#8211; + 符號條列，例如：* 項目a  * 項目b</li><li>換行：在行尾加入兩個空白</li></ul>



<p>更多 Markdown 語法可參考 <a href="https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">Markdown Cheatsheet<span class="wpel-icon wpel-image wpel-icon-6"></span></a></p>



<h2 class="para wp-block-heading">Google 試算表寄送大量郵件</h2>



<p>都設定完成後，點擊 Mail Merge for Batch Email -&gt; Send Emails Now!，點擊「是」開始送信，送信期間請保持視窗開啟，不可以關閉。</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-13 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEX_HauFjeejhoVzNlSwq2pAaL1s_pYq4NTDyhbU1Hq2VjMoe9XU-4NOpeMLMCvoAVarPzDGtafInxChbl3BTJoYfefvTxKLdn446p_9AIOIbql1SBDeUacl6xbFxvseHYgrgP3dVrdhCIVPgY5MLbCK=w888-h524-no?authuser=2" alt="Mail Merge for Batch Email 18" title="Google 試算表寄送大量郵件，每天免費 100 封"></figure></div></div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEWT9wDGO-qwGkx4M98lfJ6jMJY8sd-U-4THK7Pvr9-zqOJnUWR_6J2ntnucOv8UnCq3g14HXpSOkh460wgStfrbMXxPIeYUHe5BfTgRz5enIESszsbpKYHwZP4rrYwehnK2t9vnuxUAwT7B5HTZAifW=w719-h488-no?authuser=2" alt="Mail Merge for Batch Email 19" title="Google 試算表寄送大量郵件，每天免費 100 封"></figure></div></div>
</div>



<p>發送成功會顯示 <mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-green-cyan-color">Done</mark></p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEXkPEgqoLKehkZkAntD9oPky6eGo-C0yU9nBJaoy8hhir_W78JwYhwjaXl_Sw_61weFEdXqC2OO4oULFlDvkmEbk7gaEHzcBatccMrTIcRuOOUp-EbM3gbh8Q4NDe28kvBuL9cK0vNOY0y0nizGH14b=w1708-h448-no?authuser=2" alt="Mail Merge for Batch Email 20" title="Google 試算表寄送大量郵件，每天免費 100 封"></figure></div>


<p>過一下就可以收到信囉！有各自的內容及不同的附件</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-14 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEUHUhAkZ5nktZsLR2sl4u2UbywBnMpkhiP1AAf30nkVAQSNl8lGtXgHc3PjEYH5mixViU03pqp7It-XzI-ef_3GxJuTV6CusSTICFLlIymxwoeSZQ8HvMQSz7AAVlje0pFqV0beJdSwf6oJQW-Hz05F=w833-h848-no?authuser=2" alt="Google 試算表寄送大量郵件 1" title="Google 試算表寄送大量郵件，每天免費 100 封"></figure>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEUE2nVdBK2_-eDVvyuv5hBHwUXCNkucSWj5rI0qHFON9RSoT5OtpVcSgdhRCCfJzFMVITPOnt3Cp_QcyEvXsi3SujblL4LBVjRI3j3ylc0K4ryWspLKPUinTjFhGsdLLLwl81PeLHXIRZjRjE6DM5em=w873-h888-no?authuser=2" alt="Google 試算表寄送大量郵件 2" title="Google 試算表寄送大量郵件，每天免費 100 封"></figure>
</div>
</div>



<p>完成送信後還會寄一份詳細資料到您的信箱，包含送出的內容以及當日還能寄送多少封信</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEXEU90qnrWSjRl_PxZuRVtxEuikPHLqSLT12cK-gNWz0WnYhrGfVxFrMIOYhS6oxYnpRMRPtb88rx-nTuISri8zoyWU4ag-Y6RWwyqWAZoifCKOqppzlo8BeBZVCUzbLQOoESJCUm6h2kglV_Z_U8Z0=w1102-h496-no?authuser=2" alt="Google 試算表寄送大量郵件 3" width="551" height="248" title="Google 試算表寄送大量郵件，每天免費 100 封"></figure></div>


<p>打完收工～！</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/10751/google-%e8%a9%a6%e7%ae%97%e8%a1%a8%e5%af%84%e9%80%81%e5%a4%a7%e9%87%8f%e9%83%b5%e4%bb%b6%e6%af%8f%e5%a4%a9%e5%85%8d%e8%b2%bb-100-%e5%b0%81/" data-wpel-link="internal">Google 試算表寄送大量郵件，每天免費 100 封</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/10751/google-%e8%a9%a6%e7%ae%97%e8%a1%a8%e5%af%84%e9%80%81%e5%a4%a7%e9%87%8f%e9%83%b5%e4%bb%b6%e6%af%8f%e5%a4%a9%e5%85%8d%e8%b2%bb-100-%e5%b0%81/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Microsoft Outlook 收發 Gmail 設定教學</title>
		<link>https://noter.tw/10731/microsoft-outlook-%e6%94%b6%e7%99%bc-gmail-%e8%a8%ad%e5%ae%9a%e6%95%99%e5%ad%b8/</link>
					<comments>https://noter.tw/10731/microsoft-outlook-%e6%94%b6%e7%99%bc-gmail-%e8%a8%ad%e5%ae%9a%e6%95%99%e5%ad%b8/#respond</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Fri, 30 Dec 2022 05:44:33 +0000</pubDate>
				<category><![CDATA[技巧分享]]></category>
		<category><![CDATA[技術相關]]></category>
		<category><![CDATA[應用分享]]></category>
		<category><![CDATA[Outlook 郵件設定教學]]></category>
		<category><![CDATA[Gmail 帳號整合 Outlook]]></category>
		<category><![CDATA[Gmail 郵件設定教學]]></category>
		<category><![CDATA[Outlook]]></category>
		<category><![CDATA[Outlook 帳號整合 Gmail]]></category>
		<category><![CDATA[Outlook 收發 Gmail]]></category>
		<category><![CDATA[Outlook 設定]]></category>
		<category><![CDATA[Outlook 設定 Gmail]]></category>
		<category><![CDATA[Gmail 整合 Outlook]]></category>
		<category><![CDATA[Outlook 整合 Gmail]]></category>
		<category><![CDATA[Gmail 帳號設定 Outlook]]></category>
		<category><![CDATA[Outlook 電子郵件設定]]></category>
		<guid isPermaLink="false">https://noter.tw/?p=10731</guid>

					<description><![CDATA[<p>小蛙平常多使用瀏覽器開啟 Gmail 或用手機的 Gmail app 收發信，最近要做合併列印發送郵件的功能，因此把設定 Microsoft Outlook 收發 Gmail 的步驟記下來。</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/10731/microsoft-outlook-%e6%94%b6%e7%99%bc-gmail-%e8%a8%ad%e5%ae%9a%e6%95%99%e5%ad%b8/" data-wpel-link="internal">Microsoft Outlook 收發 Gmail 設定教學</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>小蛙平常多使用瀏覽器開啟 Gmail 或用手機的 Gmail app 收發信，最近要做合併列印發送郵件的功能，因此把設定 Microsoft Outlook 收發 Gmail 的步驟記下來。</p>



<span id="more-10731"></span>



<p>對於介紹性的內容小蛙真的很懶惰去查，因此使用了最近非常紅的 ChatGPT 來幫忙產生相關說明</p>



<h2 class="para wp-block-heading">什麼是 Outlook？</h2>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>Microsoft Outlook 是一款電子郵件客戶端軟體，除了可以收發電子郵件之外，還具有日曆、聯絡人管理、任務清單、記事本等功能。它是微軟 Office 文書處理軟體套件的一部分，也可以單獨使用。Outlook 支援多種電子郵件服務，包括 Exchange、POP3 和 IMAP，可以讓使用者從一個地方管理所有的電子郵件帳戶。Outlook 还提供了許多安全和隱私保護功能，例如密碼保護、數位簽名和加密等。</p><cite><a href="https://chat.openai.com/chat" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">ChatGPT<span class="wpel-icon wpel-image wpel-icon-6"></span></a> 產生 (無法保證資訊正確性)</cite></blockquote>



<p>Good～感謝 ChatGPT</p>



<h2 class="para wp-block-heading">使用 Outlook 收發 Gmail</h2>



<p>第一次啟動 Outlook 會要求新增帳戶，這邊輸入要使用的 Gmail 帳號，點擊連線</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEULp7Cm4LKD0oX_iGnaYWoo6aFhL8mTKRB5odMFohqeQKZ4cAQHImhxDw-zRgiMgNAhwMITIgJspq07rAjV6gSkwpy-6l3eHn3qCeWRGdCj6OcE9Uh1Iidy1Q0uzPVGEVR1JNo2zFGfwrg3zbrjgU0B=w1612-h939-no?authuser=2" alt="Microsoft Outlook 收發 Gmail 設定教學 1" width="806" height="470" title="Microsoft Outlook 收發 Gmail 設定教學"></figure></div>


<p>偵測到是 Gmail 後，開啟視窗讓使用者登入</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-15 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEVyZzdGsFPmVuqlTCEkGXTfcUw6hpKCwFhIlOAha8rz8c3ayvS8uytr0Yry4x0Hog2B__AuaPnu9F0fPlLoo13Bjww1wfI-KUkexVPxFZ5ZXcygOSSTvHeAeek22FDkCzmQNEJyPHaqjid6ZfxnA8Fe=w928-h1140-no?authuser=2" alt="Microsoft Outlook 收發 Gmail 設定教學 2" title="Microsoft Outlook 收發 Gmail 設定教學"></figure></div></div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEXuwJ_4NROsblxuH2OBA_0O0_LFziU1N9LDPQ8qpz7wj8iU37y1qHVjppJ3eW3Xv2TDRlIP40lJdoNeJT7zUwwY9M5MOUebdVBOgZ31EglxXe3BQJ_Gj1s3YSzTdKX4nwhrduCn4ea2ho_GBxpniCPE=w928-h1140-no?authuser=2" alt="Microsoft Outlook 收發 Gmail 設定教學 3" title="Microsoft Outlook 收發 Gmail 設定教學"></figure></div></div>
</div>



<p>如果有開啟二階段登入驗證的話，會再出現要求做驗證 (下圖左)，接著列出所有使用 Outlook 收發信需要使用到的權限 (下圖右)</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-16 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEXvgVP-BVBoMdSuo4sRNHeV6m1JpmcFlOEx3XBPbrCSaaViT6cKGSPmlMz_klaGV1K4y8Iy1FsznadvfNWNlp2GZtM89Ua5KEKw_39JDzkGTaNsLG98TE-Z7ZHvYDGg7ys9zAj_iNiFsLF5tTRNsO6s=w928-h1140-no?authuser=2" alt="Microsoft Outlook 收發 Gmail 設定教學 4" title="Microsoft Outlook 收發 Gmail 設定教學"></figure></div></div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEV5rYzUuKi3KRRvXjn6zyHr1JxbVrcWmJ3_f81y5kOO1j-GiMXmHCoYbgX2vuFbEaY9IlUZhEjGCcQYrF4CnJH2pxDnfiWJ5aadmg2RuAEMuAGIRPhVSvYS7ARqeXzY2kQKA69J4d28NbogWl_CS2wc=w928-h1140-no?authuser=2" alt="Microsoft Outlook 收發 Gmail 設定教學 5" title="Microsoft Outlook 收發 Gmail 設定教學"></figure></div></div>
</div>



<p>拉到最下面點選接受就完成設定了，過程非常簡單</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEXYucurbTF90HPlFJs6a5oaB6w4JOVs-omL91b4YbB0nEZVOftwa996Cc5lVZUd7O45shSN02f_rnu3-_VmphrdK_uAkt_oZlAKLdyk_Iy5_8jNyiWrnVdOWF9Rx2boKIZhCmd--HoZA1_CodOX5wdc=w1612-h939-no?authuser=2" alt="Microsoft Outlook 收發 Gmail 設定教學 6" width="806" height="470" title="Microsoft Outlook 收發 Gmail 設定教學"></figure></div>


<p>還會貼心的試寄一封郵件</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEXUtTnli7ms1b-o1oZQRGxzfzmIa93MFzNxATxfakqeLNWW7ztCqhjSP1Ypiqww2abUPqMjMSjdfy9u7KBrJ9QIJvONowaemVegzNsy0t_Ch-5-rbSgjKvky8rQoMIUQi_uVKEI-g-2tZm3HupTpICK=w2232-h1523-no?authuser=2" alt="Microsoft Outlook 收發 Gmail 設定教學 7" title="Microsoft Outlook 收發 Gmail 設定教學"></figure></div>


<p>打完收工！</p>



<pre class="wp-block-preformatted pre right green">你可能感興趣的內容：
<a href="https://noter.tw/10751/google-%e8%a9%a6%e7%ae%97%e8%a1%a8%e5%af%84%e9%80%81%e5%a4%a7%e9%87%8f%e9%83%b5%e4%bb%b6%e6%af%8f%e5%a4%a9%e5%85%8d%e8%b2%bb-100-%e5%b0%81/" data-wpel-link="internal">Google 試算表寄送大量郵件，每天免費 100 封</a>
<a href="https://noter.tw/10744/google-sheets-email-yet-another-mail-merge-mail-merger-for-gmail-yamm/" data-wpel-link="internal">Google 試算表批量發送 Email (免費版每日 50 封)</a>
<a href="https://noter.tw/10739/word-%e5%90%88%e4%bd%b5%e5%88%97%e5%8d%b0%e4%bd%bf%e7%94%a8-outlook-%e7%99%bc%e9%80%81%e9%83%b5%e4%bb%b6/" data-wpel-link="internal">Word 合併列印使用 Outlook 發送郵件</a>
</pre>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/10731/microsoft-outlook-%e6%94%b6%e7%99%bc-gmail-%e8%a8%ad%e5%ae%9a%e6%95%99%e5%ad%b8/" data-wpel-link="internal">Microsoft Outlook 收發 Gmail 設定教學</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/10731/microsoft-outlook-%e6%94%b6%e7%99%bc-gmail-%e8%a8%ad%e5%ae%9a%e6%95%99%e5%ad%b8/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Sony Xperia 強制重置手機</title>
		<link>https://noter.tw/10671/sony-xperia-%e5%bc%b7%e5%88%b6%e9%87%8d%e7%bd%ae%e6%89%8b%e6%a9%9f/</link>
					<comments>https://noter.tw/10671/sony-xperia-%e5%bc%b7%e5%88%b6%e9%87%8d%e7%bd%ae%e6%89%8b%e6%a9%9f/#comments</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Fri, 16 Dec 2022 14:48:27 +0000</pubDate>
				<category><![CDATA[技巧分享]]></category>
		<category><![CDATA[技術相關]]></category>
		<category><![CDATA[Sony Xperia]]></category>
		<category><![CDATA[重置手機]]></category>
		<category><![CDATA[手機清空]]></category>
		<category><![CDATA[忘記螢幕鎖密碼]]></category>
		<category><![CDATA[Xperia Companion]]></category>
		<category><![CDATA[Sony 手機重置]]></category>
		<category><![CDATA[清除所有資料]]></category>
		<category><![CDATA[Xperial 軟體修復]]></category>
		<guid isPermaLink="false">https://noter.tw/?p=10671</guid>

					<description><![CDATA[<p>有天同事想要重置 Sony Xperia 手機，但卻遇到忘記螢幕密碼，無法進到設定的狀況，小蛙上網搜尋了一些資料，發現竟然不像以前一樣可以按著音量降低鍵 + 電源鍵讓手機進入工程模式，再進行 FACTORY RESET 清除資料強制重置，這篇文章把使用 Xperia Companion 重置 Xperia 手機的方法記下來。</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/10671/sony-xperia-%e5%bc%b7%e5%88%b6%e9%87%8d%e7%bd%ae%e6%89%8b%e6%a9%9f/" data-wpel-link="internal">Sony Xperia 強制重置手機</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>有天同事想要重置 Sony Xperia 手機，但卻遇到忘記螢幕密碼，無法進到設定的狀況，小蛙上網搜尋了一些資料，發現竟然不像以前一樣可以按著音量降低鍵 + 電源鍵讓手機進入工程模式，再進行 FACTORY RESET 清除資料強制重置，這篇文章把使用 Xperia Companion 重置 Xperia 手機的方法記下來。</p>



<span id="more-10671"></span>



<p>小蛙現在使用的手機是 iPhone，不過因為常常要協助處理 Android 的狀況，多少還是了解一些，不過這次要幫忙重置手機卻發現沒辦法進入工程模式，上網查了一下發現 Sony Xperia 可以透過 Sony 官方的 Xperia Companion 這套軟體重置。</p>



<p>放一篇蠻詳細的重置法給大家參考 <a href="https://www.tenorshare.tw/unlock-android/how-to-unlock-android-phone.html" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">4招快速解決手機密碼忘記，手機開機密碼忘記難題，無需密碼！<span class="wpel-icon wpel-image wpel-icon-6"></span></a>，小蛙成功重置後才發現這篇文章，原來忘記螢幕鎖密碼還可以直接透過 Google 帳號處理，如果你還記得 Google 帳號密碼且還可以連網路的話，可以參考看看喔！另外兩篇是 Sony 官方的教學文件一併附在這邊 <a href="https://www.sony.com.tw/zh/electronics/support/articles/SX469601" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">我無法解鎖螢幕 (Android 5.0 或更高版本)<span class="wpel-icon wpel-image wpel-icon-6"></span></a>、<a href="https://www.sony.com.tw/zh/electronics/support/mobile-phones-tablets-tablets/articles/SX078801" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">我無法解鎖畫面 (Android 4.4 或較舊版本)<span class="wpel-icon wpel-image wpel-icon-6"></span></a>。</p>



<h2 class="para wp-block-heading">安裝 Xperia Companion</h2>



<p>連到 Sony 官網下載 <a href="https://www.sony.com/electronics/support/articles/00236877" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">Xperia Companion<span class="wpel-icon wpel-image wpel-icon-6"></span></a></p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEX93nwQzBhqr8bml_XSkItJRifanDDnn8zWHUuhduK-g8yQ5GGu774DYPJSGZsn1qH3G4ltjeifbmvxq_HwpcvL_0zmJ4v5saFeXQfucQI7ejlLAttR2zOo6Z2VEvjTsR6JORey2gWfIgfFB-JK9CPr=w1723-h926-no?authuser=2" alt="下載 Xperia Companion" width="862" height="463" title="Sony Xperia 強制重置手機"></figure></div>


<p>下載完畢後點擊兩下進行安裝。</p>



<h2 class="para wp-block-heading">使用 Xperia Companion 重置手機</h2>



<p>安裝完成後開啟 Xperia Companion 可以看到以下畫面，點擊「軟體修復」進入選單</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEU4hgMutjnNl5C7a3cDy1NFquxDlaVDCUU5JZRatjljbN2BbvoA3S2YJ6uDWX5AIRQorzzBr7IhuKkuRqtylBQ8FT_Hd0EONThWAb0iU0d3zSL0gr09lsEOfJ2FEUzW7XY8Izx2fnAOSHdZvxFLA2zF=w1127-h1084-no?authuser=2" alt="Xperia Companion 主畫面" width="564" height="542" title="Sony Xperia 強制重置手機"></figure></div>


<p>要直接重置手機的話，勾選「我的裝置無法偵測或重新啟動，或為SmartWatch3」，點擊下一步</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEXI7FuZZsyGEUAfqvZVjPlkooarWF9PKmLLY1ry9nDbEOIEtBjHeRLQXYp5wAhEcrxW9dDrQzJWlDCg66gb0yPRj3FJIHbMbuAk7djgdjl9edFk6tXjp2JrPYPZcBQtTsVXHxPMwgVnlpiVQFBpnhhZ=w1158-h1084-no?authuser=2" alt="Xperia Companion 軟體修復" width="579" height="542" title="Sony Xperia 強制重置手機"></figure></div>


<p>選擇「Xperia 手機或平板電腦」後點擊下一步，<mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color"><strong>注意：至少要維持 80% 以上的電力喔！</strong></mark></p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEW-WIWrpgYK_fwvM1AijK7W3K3uvxQhOJZMngeOi7K6NJYnhjW1dJhLfhAabTxT8KfSQzTD_AG9gqikf0dHJUuaEc73tr_ZjYqReBZkbYYfZogjLXXr_xpvNp3KXfZMr02fwPq-cODdRj399qRGwRml=w1158-h1084-no?authuser=2" alt="Xperia Companion 裝置類型" width="579" height="542" title="Sony Xperia 強制重置手機"></figure></div>


<p>這裡的提示訊息蠻嚇人的，現在小蛙需要重置就是因為要把手機清空，因為忘記螢幕鎖才使用這個方法，結果現在又需要 Google 帳號密碼，其實小蛙重置的流程並不需要再次確認 Gmail 帳號密碼，勾選「是，我知道我的 Google<sup>TM</sup> 帳號詳細資料」後點擊下一步</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEX2sud7ym9JAQ6T3sZcgFRFI8SKI7PyDye51g-wgHLwqNh3XKXQ4dO-FB9Zzq2lzaEjT7jJ-3H2njMx8WNExkHqSJUuMIm_vT7HsnpfZUkhH91Ns05xJrNjTeYc0jYQqoRy48ljVc_cmI_qS5rADJJ9=w1158-h1084-no?authuser=2" alt="Xperia Companion 提示 Google 帳號密碼" width="579" height="542" title="Sony Xperia 強制重置手機"></figure></div>


<p>等待初始化，這邊小蛙等了幾分鐘才進入下一步</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEUhGIvHp52f3shk6MEDR-89DB04_BYssS58X7c-B1QvHBi28fr_zdEKt_wvtjYiouL3TndMVvUpge7jS85ZnLsL64ofz6i5hDknIxygwMZIOyoJAkHE69kySj5t5u7QWJ36y_sRIb0ldk0qevfoiYEZ=w1158-h1084-no?authuser=2" alt="Xperia Companion 初始化" width="579" height="542" title="Sony Xperia 強制重置手機"></figure></div>


<p>確認以下事項：</p>



<ul class="my-li bg-darkblue wp-block-list"><li>請確認裝置已與電腦斷線</li><li>關閉裝置並稍等 5 秒鐘</li><li>請按住裝置上的降低音量鍵</li><li>仍按住鍵時，將裝置連結至電腦</li><li>等候應用程式自動執行至下一步驟</li></ul>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEVWa9gnYPHuqu8SZs87j0OTWbR-L6ql0ArygFmHie4f1NFbl_FZWlGklxEjyhuaT6OwmVxKMc3HY1ZjiPZw9UaYe3SU2XBsWT_mABdfa9tDKF-Fv6m8OedDFF6e3eipJw9lr0s68fsTeN_hXfoJbVHQ=w1158-h1084-no?authuser=2" alt="Xperia Companion 最後確認事項" width="579" height="542" title="Sony Xperia 強制重置手機"></figure></div>


<p>上述步驟都正確的話，會跳到以下畫面，注意所有資料都會被清除喔！勾選「我瞭解將會遺失個人內容」後點擊下一步</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEWalXaP9HjK3bFdWNTanPwafTYSOSGy5Sai5f3j0h3LyyQHyf1tXvpKlrW2eUCKyC7LxKCpPURCB1WN1C4ofZsq1GcEIoLTSRvSQOin7Lt9xYwa6bWHinL57lFl0uTNkm55ZiJp3_KWZhwKCP7KZF3F=w1158-h1084-no?authuser=2" alt="Xperia Companion 資料清除確認" width="579" height="542" title="Sony Xperia 強制重置手機"></figure></div>


<p>最後確認畫面，重置期間無法做任何動作，包含緊急通話，點擊下一步之後就開始重置了</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEUsX5NV3tNpu0ng085QifmZC52NeupoFP5CGPi6DbIlwfa6UYfUcw9rsGK0WY-vBz5B03vlqkADaLkJ-gt3ceLxbujsCOXC0AJPf6WUDiK-XjxAC4Wwtr4wcioObI2EgrrSJVmlgT7rx51M0nfUHnUL=w1158-h1084-no?authuser=2" alt="Xperia Companion 開始重置手機確認" width="579" height="542" title="Sony Xperia 強制重置手機"></figure></div>


<p>重置中，注意千萬別讓手機此時斷線，不然可能會變成磚頭 (從前刷機刷壞，造成手機整台壞掉無法重開或做其他動作的狀況就叫磚頭)</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEX49pMcqOYdFefHlDYU5FW0dNTlZyR0yqD6OOYHfa9_M4kwwDL9hlb8xaR5urN-knoEUIEERYjlv-rRgR6FfE7xlqoKPw37yMuFItMdInjz5GGQYqbLVmpu5NrHRE0jhmOQ4SvxBJlUOXZs3ctQeuTs=w1158-h1084-no?authuser=2" alt="Xperia Companion 手機重置中" width="579" height="542" title="Sony Xperia 強制重置手機"></figure></div>


<p>重置完成！先將手機斷線，接著開啟手機，第一次開機會使用比較久的時間，到這邊就打完收工囉！</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEUjywVqRQ5cBhyW6fNZPrdX9TYMARveN0ly2XGTiQL2W7zgKTAbQAj-BzDBxkos23Mn3RJY15xdZROAXY0cAxLM-J63MvFHbcGSyOKioMwkXuXW2txFcNBa9wV4U29b0JjempmKkNOhhI9od-Tz-wjT=w1158-h1084-no?authuser=2" alt="Xperia Companion 重置完成" width="579" height="542" title="Sony Xperia 強制重置手機"></figure></div><p>這篇文章 <a rel="nofollow" href="https://noter.tw/10671/sony-xperia-%e5%bc%b7%e5%88%b6%e9%87%8d%e7%bd%ae%e6%89%8b%e6%a9%9f/" data-wpel-link="internal">Sony Xperia 強制重置手機</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/10671/sony-xperia-%e5%bc%b7%e5%88%b6%e9%87%8d%e7%bd%ae%e6%89%8b%e6%a9%9f/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>無法開啟 PHP ZipArchive 下載的 zip 檔</title>
		<link>https://noter.tw/10668/%e7%84%a1%e6%b3%95%e9%96%8b%e5%95%9f-php-ziparchive-%e4%b8%8b%e8%bc%89%e7%9a%84-zip-%e6%aa%94/</link>
					<comments>https://noter.tw/10668/%e7%84%a1%e6%b3%95%e9%96%8b%e5%95%9f-php-ziparchive-%e4%b8%8b%e8%bc%89%e7%9a%84-zip-%e6%aa%94/#respond</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Fri, 16 Dec 2022 13:19:02 +0000</pubDate>
				<category><![CDATA[網頁後端]]></category>
		<category><![CDATA[網頁前端]]></category>
		<category><![CDATA[技術相關]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ZipArchive]]></category>
		<category><![CDATA[PHP zip]]></category>
		<category><![CDATA[PHP 壓縮檔案]]></category>
		<category><![CDATA[ob_clean()]]></category>
		<category><![CDATA[網頁直接下載檔案]]></category>
		<guid isPermaLink="false">https://noter.tw/?p=10668</guid>

					<description><![CDATA[<p>PHP 內有一個用來操控壓縮檔的 ZipArchive 模組，今天收到問題回報說下載的 zip 檔沒辦法開啟，當下直覺認為是對方操作錯誤，給幾個同事測試之後，有一個同事同樣無法開啟，竟然是因為檔頭多了一些空白造成，這篇記錄此問題的解法。</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/10668/%e7%84%a1%e6%b3%95%e9%96%8b%e5%95%9f-php-ziparchive-%e4%b8%8b%e8%bc%89%e7%9a%84-zip-%e6%aa%94/" data-wpel-link="internal">無法開啟 PHP ZipArchive 下載的 zip 檔</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>PHP 內有一個用來操控壓縮檔的 ZipArchive 模組，今天收到問題回報說下載的 zip 檔沒辦法開啟，當下直覺認為是對方操作錯誤，給幾個同事測試之後，有一個同事同樣無法開啟，竟然是因為檔頭多了一些空白造成，這篇記錄此問題的解法。</p>



<span id="more-10668"></span>



<h2 class="para wp-block-heading">PHP 壓縮檔案</h2>



<p>這邊是留給自己的 ZipArchive 用法的 memo，確定載入此模組後，只要使用以下方法就可以輕鬆把檔案壓縮成 zip</p>



<pre class="EnlighterJSRAW" data-enlighter-language="php" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">// 建立 ZipArchive 物件
$zip = new ZipArchive();
// 在指定路徑中建立一個 zip 檔
$res = $zip->open('tmp_callback/123.zip', ZipArchive::CREATE);
// 把 tmp_callback/file1 新增至 zip 內，並改名為 00000001.txt
$zip->addFile('tmp_callback/file1', '00000001.txt');
// 關閉 zip 物件
$zip->close();</pre>



<h2 class="para wp-block-heading">透過網頁下載 zip 檔</h2>



<p>透過以下的語法可以讓瀏覽器直接下載 zip 檔，一方面在之前做權限控管以及避免洩漏檔案真實路徑</p>



<pre class="EnlighterJSRAW" data-enlighter-language="php" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">$path = "/var/www/html/uploads/";
$filename = '03082358.zip';
	
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"".$filename."\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($path . $filename));
@readfile($file);</pre>



<h2 class="para wp-block-heading">無法開啟壓縮檔的原因</h2>



<p>直到有使用者反應壓縮檔無法開啟，透過 <a href="https://unzip-online.com/en/zip" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">unzip-online.com<span class="wpel-icon wpel-image wpel-icon-6"></span></a> 線上解壓縮也失敗</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEUmC2qlg12i3weQMfhMjRT7Fs36NTNVuXgAmZ14RgARuzc-f3A5P6-R6RVcbFWjuV5zg2buO7UDMNQzmuJq7Yjz6p6uhzi36eDw9VLmBYSYsFfAzZnhLX-h94Sj4Ha-4Vu11rgEEmMHazPjEb01fLom=w940-h463-no?authuser=1" alt="AL9nZEUmC2qlg12i3weQMfhMjRT7Fs36NTNVuXgAmZ14RgARuzc f3A5P6 R6RVcbFWjuV5zg2buO7UDMNQzmuJq7Yjz6p6uhzi36eDw9VLmBYSYsFfAzZnhLX h94Sj4Ha 4Vu11rgEEmMHazPjEb01fLom=w940 h463 no?authuser=1 無法開啟 PHP ZipArchive 下載的 zip 檔" width="470" height="232" title="無法開啟 PHP ZipArchive 下載的 zip 檔"></figure></div>


<p>使用 notepad++ 開啟後才發現 zip 檔開頭有三行空白，可是有些電腦可以正常開啟有些電腦卻不行</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEVkfKvVTFLvsECju82DL81lA0cgTr9UbDAzMFQKa0EYoBTd7BkCwQVNsgf7pAeJbFT5wvfG7ovzLSIsHevoDTCTe6caIDyIJmvsoi6cgQzor9JIL0mvkwUAsczIPFE7Eq6i99yno-QHzmq8WTTKaliH=w208-h119-no?authuser=1" alt="AL9nZEVkfKvVTFLvsECju82DL81lA0cgTr9UbDAzMFQKa0EYoBTd7BkCwQVNsgf7pAeJbFT5wvfG7ovzLSIsHevoDTCTe6caIDyIJmvsoi6cgQzor9JIL0mvkwUAsczIPFE7Eq6i99yno QHzmq8WTTKaliH=w208 h119 no?authuser=1 無法開啟 PHP ZipArchive 下載的 zip 檔" width="156" height="89" title="無法開啟 PHP ZipArchive 下載的 zip 檔"></figure></div>


<p>只要把那三行空白刪除，就可以正常解壓縮了 &#8230;</p>



<h2 class="para wp-block-heading">無法開啟壓縮檔的解決方法</h2>



<p>一開始以為是 ZipArchive 模組的問題，做了各種嘗試後發現，產出來的 zip 是正常的，並沒有上面那三行空白，那問題就是出在下載這段了。</p>



<p>試了很多方法發現只要有<code>&lt;?php include_once "xxx.php" ?&gt;</code>就會有三行空白的狀況，一開始笨笨的試著把所有用到的 include 都拔進來放，後來覺得這樣實在是又累又蠢，最後終於找到簡單解法 &#8230; 只要在<code>readfile</code>之前呼叫<code>ob_clean();</code>就可以避免這個問題 &#8230; </p>



<pre class="EnlighterJSRAW" data-enlighter-language="php" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">// 以上省略
ob_clean();
@readfile($file);</pre>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/10668/%e7%84%a1%e6%b3%95%e9%96%8b%e5%95%9f-php-ziparchive-%e4%b8%8b%e8%bc%89%e7%9a%84-zip-%e6%aa%94/" data-wpel-link="internal">無法開啟 PHP ZipArchive 下載的 zip 檔</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/10668/%e7%84%a1%e6%b3%95%e9%96%8b%e5%95%9f-php-ziparchive-%e4%b8%8b%e8%bc%89%e7%9a%84-zip-%e6%aa%94/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Ubuntu 安裝及設定 vsftp</title>
		<link>https://noter.tw/10572/ubuntu-%e5%ae%89%e8%a3%9d%e5%8f%8a%e8%a8%ad%e5%ae%9a-vsftp/</link>
					<comments>https://noter.tw/10572/ubuntu-%e5%ae%89%e8%a3%9d%e5%8f%8a%e8%a8%ad%e5%ae%9a-vsftp/#respond</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Wed, 14 Dec 2022 14:22:51 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[技術相關]]></category>
		<category><![CDATA[VSFTPD]]></category>
		<category><![CDATA[FTP 架設]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[FTP Server]]></category>
		<guid isPermaLink="false">https://noter.tw/?p=10572</guid>

					<description><![CDATA[<p>好久沒有設定 FTP 了，最近遇到需要架設 FTP 的情況，這篇文章參考自：How to Setup FTP Server with VSFTPD on Ubuntu 20.04，小蛙把自己實際使用流程記錄下來。</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/10572/ubuntu-%e5%ae%89%e8%a3%9d%e5%8f%8a%e8%a8%ad%e5%ae%9a-vsftp/" data-wpel-link="internal">Ubuntu 安裝及設定 vsftp</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>好久沒有設定 FTP 了，最近遇到需要架設 FTP 的情況，這篇文章參考自：<a href="https://linuxize.com/post/how-to-setup-ftp-server-with-vsftpd-on-ubuntu-20-04/" target="_blank" rel="noopener nofollow external noreferrer" data-wpel-link="external" class="wpel-icon-right">How to Setup FTP Server with VSFTPD on Ubuntu 20.04<span class="wpel-icon wpel-image wpel-icon-6"></span></a>，小蛙把自己實際使用流程記錄下來。</p>



<span id="more-10572"></span>



<p>小蛙收到的需求是要架設 FTP Sever ，建立一個特定使用帳號，並將該帳號的家目錄設定在特定路徑下，該文章完全符合小蛙的需求，照著做之後把過程中文化並記錄下來，開始吧！</p>



<h2 class="para wp-block-heading">安裝 vsftp</h2>



<p>這邊使用較輕巧且設定簡單的 vsftp，透過以下指令進行安裝</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">sudo apt update
sudo apt install vsftpd</pre>



<p>安裝完成後可輸入<code>systemctl status vsftpd</code>查看是否正常安裝及運作</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEV3AgG8GoL9_WGoPcykIL-ymilahtGTXvqcfUXeNM0LEoixhPME-Vz3llgaX1xKm2hhcZcMBKYOap-BgzQAqQ-rmeW9ooWA_Nowtss-iNLwed2kYzd4h0B-TXSts0qVhHtN6zA21SAV5NqYVaXWeDuH=w2585-h570-no?authuser=2" alt="AL9nZEV3AgG8GoL9 WGoPcykIL ymilahtGTXvqcfUXeNM0LEoixhPME Vz3llgaX1xKm2hhcZcMBKYOap BgzQAqQ rmeW9ooWA Nowtss iNLwed2kYzd4h0B TXSts0qVhHtN6zA21SAV5NqYVaXWeDuH=w2585 h570 no?authuser=2 Ubuntu 安裝及設定 vsftp" title="Ubuntu 安裝及設定 vsftp"></figure></div>


<h2 class="para wp-block-heading">設定 vsftp</h2>



<p>vsftp 的設定檔在<code>/etc/vsftpd.conf</code>，小蛙這邊將進行以下 5 項設定，第 6 項傳輸加密部份因為沒有要用到，這邊就不另外提了。</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">sudo vim /etc/vsftpd.conf</pre>



<h3 class="para wp-block-heading">1. 存取限制</h3>



<p>設定禁止匿名者登入，以及本地帳號皆可使用</p>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">anonymous_enable=NO
local_enable=YES</pre>



<h3 class="para wp-block-heading">2. 允許上傳</h3>



<p>若要讓使用者上傳檔案，須將以下設定開啟</p>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">write_enable=YES</pre>



<h3 class="para wp-block-heading">3. 限制目錄切換</h3>



<p>基於安全性問題，想將使用者限制在特定區域，避免有心人士的非法行為，加上以下這兩項設定</p>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">chroot_local_user=YES
allow_writeable_chroot=YES</pre>



<h3 class="para wp-block-heading">4. 被動連線 (PASV)</h3>



<p>FTP Server 可以設定 (1) <strong>主動模式</strong> 及 (2) <strong>被動模式</strong>，在設定檔加入<code>pasv_min_port</code>及<code>pasv_max_port</code>兩個參數可限縮被動模式使用的 port 區間。</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>兩種模式各有優缺點，主動模式對伺服器來說比較安全，但對用戶端來說卻是可能帶來危險，因此很可能被用戶端的防火牆所阻擋了。使用被動模式雖然解決了用戶端的問題，但相對的伺服器必須開啟一定範圍的通訊埠供用戶端連線，好在目前絕大部分的 FTP 伺服器軟體，皆可以由管理者決定開啟哪些範圍的通訊埠。</p><cite><a href="https://matis.pixnet.net/blog/post/22918494" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">FTP 主動模式與被動模式<span class="wpel-icon wpel-image wpel-icon-6"></span></a></cite></blockquote>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">pasv_min_port=30000
pasv_max_port=31000</pre>



<h3 class="para wp-block-heading">5. 限制登入</h3>



<p>除了上面設定的本機使用者可以登入外，也可以使用下面這些設定，僅讓清單上的使用者登入 FTP，我們將設定檔放在<code>/etc/vsftpd.user_list</code>內，檔案內一行為一個使用者帳號</p>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">userlist_enable=YES
userlist_file=/etc/vsftpd.user_list
userlist_deny=NO</pre>



<h3 class="para wp-block-heading">6. 傳輸加密</h3>



<p>小蛙這次設定沒有要用到，可參考<a href="https://linuxize.com/post/how-to-setup-ftp-server-with-vsftpd-on-ubuntu-20-04/" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">原文<span class="wpel-icon wpel-image wpel-icon-6"></span></a>進行設定。</p>



<h2 class="para wp-block-heading">設定防火牆</h2>



<p>設定好 vsftp 之後，安全起見還是要把防火牆設定起來，FTP 需要開啟 port 20, port 21 以及上面設定的被動模式 port 區間</p>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">sudo ufw allow 20:21/tcp
sudo ufw allow 30000:31000/tcp</pre>



<h2 class="para wp-block-heading">建立及設定 FTP 使用者</h2>



<p>剛剛我們設定了只有<code>/etc/vsftpd.user_list</code>清單上的使用者才可以登入 FTP，現在就來新增一個 FTP 專用帳號</p>



<h3 class="para wp-block-heading">1. 新增使用者</h3>



<p>使用<code>adduser</code>建立一個使用者 <strong>newftpuser</strong> (帳號換成自己要的)，並且把該使用者加入到允許登入清單中</p>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">sudo adduser newftpuser
echo "newftpuser" | sudo tee -a /etc/vsftpd.user_list</pre>



<h2 class="para wp-block-heading">禁止 Shell 登入</h2>



<p>由於只想讓該帳號使用 FTP 的功能，不希望該帳號透過 SSH 的方式登入進主機，新增一個名為 ftponly 的 Shell</p>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">echo -e '#!/bin/sh\necho "This account is limited to FTP access only."' | sudo tee -a  /bin/ftponly
sudo chmod a+x /bin/ftponly</pre>



<p>將我們建立的<code>/bin/ftponly</code>加入到 shell 清單中</p>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">echo "/bin/ftponly" | sudo tee -a /etc/shells</pre>



<p>接著把 newftpuser 的 shell 指定為<code>/bin/ftponly</code></p>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">sudo usermod newftpuser -s /bin/ftponly</pre>



<p>完成後如果嘗試使用該帳號登入 SSH，就會看到以下訊息 ~</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEV2P6iHyGzhhoM3cYHRI4fKRncPUuLSCN2BKdVtY4uU3EKP7Lr1ugBZMF9YxX46KlpWUkzupDWKPlBVY_OJkhsQ9ei6sPmZjQytTaHh6uAp-6as18oigcFpIbBPUJEWXLPYgZAugbXJN_aR5k59X3Qf=w1499-h523-no?authuser=2" alt="AL9nZEV2P6iHyGzhhoM3cYHRI4fKRncPUuLSCN2BKdVtY4uU3EKP7Lr1ugBZMF9YxX46KlpWUkzupDWKPlBVY OJkhsQ9ei6sPmZjQytTaHh6uAp 6as18oigcFpIbBPUJEWXLPYgZAugbXJN aR5k59X3Qf=w1499 h523 no?authuser=2 Ubuntu 安裝及設定 vsftp" width="375" height="131" title="Ubuntu 安裝及設定 vsftp"></figure></div>


<p>打完收工！同場加映，因為小蛙還要重新設定使用者家目錄，透過以下指令即可完成。</p>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">sudo usermod -d /my/new/path newftpuser</pre>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/10572/ubuntu-%e5%ae%89%e8%a3%9d%e5%8f%8a%e8%a8%ad%e5%ae%9a-vsftp/" data-wpel-link="internal">Ubuntu 安裝及設定 vsftp</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/10572/ubuntu-%e5%ae%89%e8%a3%9d%e5%8f%8a%e8%a8%ad%e5%ae%9a-vsftp/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
