LoginSignup
sergiroberto0921
@sergiroberto0921 (創 藤田)

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

gasでメールマガジン配信したいのですが、icloudに送ると件名が邪魔する! 力添えをお願いしたい!

解決したいこと

GASでメールマガジンを作ろうと思っているんですが、iphoneのIcloudメールに届いた時に件名が邪魔なので消したい。
outlookでも件名なしと表示されるので、できれば何も出ない状態にしたい

InkedIMG_6112_LI.jpg

または、問題・エラーが起きている画像をここにドラッグアンドドロップスクリーンショット (34)_LI.jpg

該当するソースコード

function insertonName(){

  const sheet = SpreadsheetApp.getActiveSheet();
  const lastRow = sheet.getLastRow();
  console.log(lastRow);

  const html = HtmlService.createHtmlOutputFromFile("").getContent();
  const lansubject = ""; 
  const panf = DriveApp.getFileById("");

  for(let i = 2; i <= lastRow; i++){

   const company = sheet.getRange(i,1).getValue();
   const lastName = sheet.getRange(i,2).getValue(); //姓
   const firstName = sheet.getRange(i,3).getValue();//名
   const recipient = sheet.getRange(i,4).getValue();


    const body = html.replace('{社名}',company).replace('{姓}',lastName).replace('{名}',firstName);


    const option = {"name": "",
                    "htmlBody": body,
                    "inlineImages":{}
                   };
    console.log(body);
    console.log(option);
    const txt = "";




   GmailApp.sendEmail(recipient, lansubject, txt, option);

 }
}

自分で試したこと

該当するのはlansubjectの所だとおもうのですが、lansubjectの部分に何も入れずに送ると件名なしになってしまうので、どうにかしたいです。

0

3Answer

Comments

  1. 回答ありがとうございます。今試しては見たんですが、件名なしと出てしまいます。
  2. 返信遅れて申し訳ございません。最初に回答して頂いた全角でスペースを空けるとのことなんですが、icloudの方では件名なしが消えました。ただ件名なしというのが消えただけで空白ができてしまい解決したとは言い難いです。

    一応outlookに対応できるようtableでデザインつくっていたのですが、
    table要素でデザインを作らずに本来のマージンなどで作った際は交友右側の空白などはできませんでした。

    なにか仕様などがあるんでしょうか?


    <body style="margin: 0px;">
    <table width="640" border="0" cellspacing="0" cellpadding="0" align="center" style="width: 640px; margin: 0px auto;" >
    <tr>
    <td width = "60" style="font-size: 0; line-height: 0;"></td>
    <td width = "520" style="font-size: 0; line-height: 0;">
    <a href="http://www.fujita-jpn.co.jp/">
    <div><img src='cid:panfImg' alt="" width= "100%" style="width: 100%;"></div>
    </a>
    </td>
    <td width = "60" style="font-size: 0; line-height: 0;"></td>
    </tr>
    <tr>
    <td width = "60" style="font-size: 0; line-height: 0;"></td>
    <td width = "520" >
    <table width="520" border="0" cellspacing="0" cellpadding="0" style="width: 520px;" >
    <tr><td align="center" style="font-size: 1.7rem; line-height: 1.7;"><b>【Tokyo Tokyo ALL JAPAN COLLECTION】出展のお知らせ</b></td></tr>
    <tr><td height="10" style="font-size: 0; line-height: 0;"></td></tr>
    <tr>
    <td align="center" style="font-size: 1.7rem; line-height: 1;" @media="screen and (max-width:480px){ style='font-size: 3.0rem;}">
    毎々格別のお引き立てをいただき有難うございます。<br>コロナ禍で規模も縮小されていますが、東京2020大会が開催しました。それに伴い東京都主催の「~東京、日本各地の魅力を東京スポーツスクエアから発信~Tokyo Tokyo ALL JAPAN COLLECTION」というイベントに参加致します。
    東京、日本全国が誇る伝統芸能や技術、特産品、豊かな食の世界などのあらゆる要素が大集合し、どなたでもお楽しみいただけるイベントです。
    せひご来場ください。<br>株式会社フジタ・ジャパン
    </td>
    </tr>
    <tr><td height="10" style="font-size: 0; line-height: 0;"></td></tr>
    </table>
    </td>
    <td width = "60" style="font-size: 0; line-height: 0;"></td>
    </tr>
    <tr>
    <td width = "60" style="font-size: 0; line-height: 0;"></td>
    <td width = "520" height= "40"></td>
    <td width = "60" style="font-size: 0; line-height: 0;"></td>
    </tr>
    <tr>
    <td width = "60" style="font-size: 0; line-height: 0;"></td>
    <td width = "520">
    <table>
    <tr>
    <td width = "40" style="font-size: 0; line-height: 0;"></td>
    <td width = "480">
    <table width = "100%" border="0" cellspacing="0" cellpadding="0" style="width: 100%;">
    <tr>
    <td style="font-size: 1.3rem; ">出展日:2021年9月2日㈭~9月3日㈮ 11:30~18:30</td>
    </tr>
    <tr>
    </tr>
    <tr>
    <td style="font-size: 1.3rem; line-height: 1.4;">
    <table border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width = "64" style="font-size: 0; line-height: 0;"></td>
    <td width = "400" style="font-size: 1.3rem; line-height: 1.4;">〒100-0005 東京都千代田区丸の内3-8-3</td>
    <td width = "0" style="font-size: 0; line-height: 0;"></td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td align="center"style="font-size: 1.3rem; line-height: 1.2;">
    <table border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width = "59" style="font-size: 0; line-height: 0;"></td>
    <td width = "400" style="font-size: 1.3rem; line-height: 1.4;">*東京交通会館向かいの赤い屋根が目印の建物です</td>
    <td width = "0" style="font-size: 0; line-height: 0;"></td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td width="100%" height ="30" style ="font-size: 0px; line-height: 1.4;"></td>
    </tr>
    <tr>
    <td align = "center" style="font-size: 1.3rem; line-height: 1.4;">展示品</td>
    </tr>
    <tr>
    <td style="font-size: 1.3rem; line-height: 1.4;">高所Jidoribo-Pro・各種工業用内視鏡・各種光学レンズ</td>
    </tr>
    <tr>
    <td align="center" style="font-size: 1.3rem; line-height: 1.7;">CCD・CMOSカメラ</td>
    </tr>
    <tr>
    <td></td>
    </tr>
    </table>
    </td>
    <td width = "0" style="font-size: 0; line-height: 0;"></td>
    </tr>
    </table>
    </td>
    <td width = "60" style="font-size: 0; line-height: 0;"></td>
    </tr>

    <tr>
    <td width = "60" style="font-size: 0; line-height: 0;"></td>
    <td width = "520" style="font-size: 0; line-height: 0;">
    <table width ="100%" border="0" cellspacing="0" cellpadding="0" style="width: 100%;">
    <tr>
    <td height="20" width="100%" style="font-size: 0; line-height: 0;"></td>
    </tr>
    <tr>
    <td height="2" width="100%" bgcolor="green"></td>
    </tr>
    <tr>
    <td height="20" width="100%"style="font-size: 0; line-height: 0;"></td>
    </tr>
    </table>
    </td>
    <td width = "60" style="font-size: 0; line-height: 0;"></td>
    </tr>
    <tr>
    <td width = "60" style="font-size: 0; line-height: 0;"></td>
    <td width = "520" >
    <table width ="100%" border="0" cellspacing="0" cellpadding="0" style="width: 100%;">
    <tr>
    <td width ="40" style="font-size: 0; line-height: 0;"></td>
    <td width ="150" >
    <table>
    <tr>
    <td width="100%" style="font-size: 1.3rem;">
    <a href="">
    <img width="100%" src='cid:panfJidori' alt="">
    </a>
    </td>
    </tr>
    <tr>
    <td width="100%" align="center" style="font-size: 1.5rem; line-height: 2;">カタログの請求</td>
    </tr>
    <tr>
    <td width="100%" align="center"style="font-size: 1.3rem;">フジタジャパンでは三種類のカタログからお選びいただけます</td>
    </tr>
    <tr>
    <td width="100%" align="center"style="font-size: 1.3rem;">請求はこちらから</td>
    </tr>
    </table>
    </td>
    <td width ="40" style="font-size: 0; line-height: 0;"></td>
    <td width = "150">
    <table>
    <tr>
    <td width="100%" style="font-size: 1.3rem;">
    <a href="">
    <img width="100%" src='cid:panfNaishi' alt="">
    </a>
    </td>
    </tr>
    <tr>
    <td width="100%" align="center" style="font-size: 1.5rem; line-height: 2;">カタログの請求</td>
    </tr>
    <tr>
    <td width="100%" align="center"style="font-size: 1.3rem;">フジタジャパンでは三種類のカタログからお選びいただけます</td>
    </tr>
    <tr>
    <td width="100%" align="center"style="font-size: 1.3rem;">請求はこちらから</td>
    </tr>
    </table>
    </td>
    <td width ="40" style="font-size: 0; line-height: 0;"></td>
    </tr>
    </table>
    </td>
    <td width = "60" style="font-size: 0; line-height: 0;"></td>
    </tr>
    </table>

iPhoneのメールアプリ、outlookで件名なしと表示されるかどうかはアプリ側の問題だと思うので、空白を件名と思わせて表示させるぐらいしか回避策はないような...

const lansubject = String.fromCharCode(12644)

もしくは全角スペースではなくこういう文字を突っ込むとか?(だとしても件名を表示するスペースは消えないと思うけど、ちょっとどういう事がしたいのかよく分からない)

本来のマージン

っていうのはなんですか?tableタグを使わないでcssで制御してるとかそういう事ですか?

0Like

Comments

  1. 説明不足で申し訳ないです。

    本来のマージンに関しては、そうですね。tableタグを使わずにcssで制御してることですね。

    解決したいことに関しては、iphoneのメールアプリに出てくる件名の部分のスペースと
    iphoneのメールアプリでtableタグでレイアウトを組むと出てくる右側のスペースを消したいってことですね。

    なんですけど、github0013さんのおっしゃってる通り、件名の部分に関してはメールアプリの問題な気もしますし、tableタグでレイアウトを組むと右側のスペースが生まれてしまうのに関してはtableタグを使わずにcssで制御してた場合には出てこなかったので回避策はあんまりないのかなと思ってるんですが、提案して頂いたコードも入れてみて試してみます。




68747470733a2f2f71696974612d696d6167652d73746f72652e73332e61702d6e6f727468656173742d312e616d617a6f6e6177732e636f6d2f302f3832373332332f35633132666461342d396132612d323435662d333437662d6236303230326231623339382e6a706567-2.jpg

そうだとするなら、なんとなくtableのサイズを決め打ちで作ってるところが気になりますが。

自分なら今表示したい実際の内容は一旦置いておいて、まず枠組みだけ作って自分が思っているように表示されるかどうかやってみます。(borderつけて、背景色とか色々つけて分かりやすく)

htmlメールはやった事ないですが結構面倒らしいので、
https://www.caniemail.com/
とかでサポートされているタグやcssを確認しながらまずは思い通りの枠組みが作れるかやってみたほうが早いと思います。

0Like

Your answer might help someone💌