Gmail正文中的html表格

时间:2015-06-03 22:39:49

标签: html html-email

我是使用SDK将快照插入邮件并从Unity发送。但我也在这封电子邮件中插入文字。我希望它以表格的形式格式化。当我在iPhone邮件应用程序中打开它而不是在Android上的Gmail应用程序中打开它时,我编写的代码看起来格式化了。有人能告诉我,我在某个地方出错了吗?

但是,如果我将邮件从iPhone发送到我的Gmail帐户,它看起来非常好。只有当我打开邮件应用程序发送内容时,它看起来很糟糕。稍后将仅考虑
标签,但不考虑表标签。

代码可能不是最高标准,但这里是

 body = "<html><body>" + divDeviceInfo + "<br>";
    body += "Unity Version = " + Application.unityVersion + "<br>";
    body += "Selected Server URL = " + LoginScreenSet.SelectedServerUrl + "<br>";
    body += "SVN Version " + string.Format("{0}.{1}", Config.BUNDLE_VERSION, Config.SVN_REVISION) + "<br>";
    body += "Client: " + client + "<br>"; 
    body += "Player Name: " + LiveData.Player.name + "<br>"; 
    body += "Player ID: " + LiveData.Player.player_id + "<br>"; 
    body += "Device ID: " + DeviceBridge.GetSavedUdid() + "<br>";
    body += "Hardware: " + UnityEngine.SystemInfo.deviceModel + "<br>";
    body += "Device: " + UnityEngine.SystemInfo.deviceName + "<br>";
    body += "OS: " + UnityEngine.SystemInfo.operatingSystem + "<br>";
    body += "OS Version: " + os_version + "<br>"; 
    body += "Client Version:" + Config.BUNDLE_VERSION + "<br>"; 
    body += "Client Revision:" + Config.SVN_REVISION + "<br>"; 
    body += "Static Data: " + StaticData.Inst.DataVersion + "<br>";
    body += Environment.NewLine;


    List<LogEntry> _recentLogs = Logger._recentLogs;

    string[] _recentLogsInString = new string[_recentLogs.Count];
    int i = 0;


    //start the table and put headings
    logs = "<table><tr><th>ThreadID</th><th>TimeStamp</th><th>Level</th><th>Channel</th><th>Message</th></tr>";
    foreach (LogEntry _entry in _recentLogs)
    {


        logs += "<tr><td>"+ _entry.ThreadId.ToString() +"</td>";
        logs += "<td>" + _entry.Timestamp.ToString() + "</td>";
        logs += "<td>" + _entry.Level.ToString() + "</td>";
        logs += "<td>" + _entry.Channel.ToString() + "</td>";
        logs += "<td>" + _entry.Msg.ToString() + "</td></tr>";

    }
    //End the table
    logs += "</table></body></html>";
    body += logs;

1 个答案:

答案 0 :(得分:0)

html电子邮件呈现引擎通常处于石器时代。您最好的选择是使用alignhspacevspace等古老属性。不确定哪个引擎gmail正在使用,但是你可以查看它并查看哪些属性将以它为目标。