the divider line way too long on outlook - ios

I have coded an email template and it works great overall but I have an issue with the length of the divider line:
The divider is way too long when I send a test mail to my outlook mail but have the right length on all other mail clients.
<table border="0" agrepeatingblock="active" role="presentation" cellpadding="0" width="100%" cellspacing="0" style="width: 100%;" agid="greenline-development_group_2_block_11">
<tr>
<td align="center" style="vertical-align:top;padding:Block::Margin_top|INTEGER|0px 0 Block::Margin_bottom|INTEGER|0px;">
<table width="100%" border="0" cellspacing="0" cellpadding="0" role="presentation" style="width:100%;background-color:Block::Block_container|COLOR|transparent;">
<tr>
<td align="center" style="vertical-align: top;">
<!--[if (gte mso 9)|(IE)]>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" style="width:100%;" role="presentation">
<tr>
<td align="center" valign="top" width="100%" style="width:100%; max-width:706px">
<![endif]-->
<table border="0" cellpadding="0" width="100%" cellspacing="0" style="width:100%;max-width:706px;Margin:0 auto;background-color:Block::Content_container|COLOR|transparent;" role="presentation">
<tr>
<td align="center" style="vertical-align:top;padding:${blockparam:Block::Padding_top|INTEGER|10}px 12px 0;" class="pt-10">
<table width="100%" border="0" cellspacing="0" cellpadding="0" role="presentation" style="width: 100%;">
<tr>
<td align="center" style="vertical-align: top; padding: 10px 12px;">
<table width="100%" border="0" cellspacing="0" cellpadding="0" role="presentation" style="width: 100%;">
<tr>
<td
height="${blockparam:Block::Padding_bottom|INTEGER|10}"
style="border-top:${blockparam:Horizontal_rule::Size|INTEGER|1}px solid ${blockparam:Horizontal_rule::Color|COLOR|#47c16c};height:${ref:Block::Padding_bottom}px;font-size:${ref:Block::Padding_bottom}px;line-height:${ref:Block::Padding_bottom}px;"
class="h-sm-10"
></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]-->
</td>
</tr>
</table>
</td>
</tr>
</table>

Related

I want to send an email to user with html template in mvc.net

I want to send an email to user with html template in mvc.net i am trying to bind html template but it goes simple mail template is not showing, here is my code.
here is Controller Code
private void SendActivationEmail(AddCenter center)
{
Guid activationCode = Guid.NewGuid();
TrueScanEntities db = new TrueScanEntities();
db.UserActivations.Add(new UserActivation
{
ID = center.Center_ID,
ActivationLink = activationCode
});
db.SaveChanges();
using (MailMessage mm = new MailMessage("sender#gmail.com", center.Center_Email))
{
StreamReader reader = new StreamReader(Server.MapPath("~/EmailTemplate/EmailTemplate.html"));
mm.Subject = "Account Credential";
string body = "Hello " + center.CenterIncharge + ",";
body += "<br /><br />Your Account Credential is given below" + "<br/>" + "User Name"+":"+"<br/>"+ center.Center_Email+"<br/>"+"Password"+":"+ center.Center_Passwrd + ".";
//body += "<br /><br />Please click the following link to activate your account";
//body += "<br /><a href = '" + string.Format("{0}://{1}/Admin/Activation/{2}", Request.Url.Scheme, Request.Url.Authority, activationCode) + "'>Click here to activate your account.</a>";
body += "<br /><br />Thanks";
mm.Body = body;
mm.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
NetworkCredential NetworkCred = new NetworkCredential("abc#gmail.com", "123");
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 587;
smtp.Send(mm);
}
}
here is a HTML template i want to send user their userid and password in given template.
what should i do in html template?
<table align="center" cellpadding="0" cellspacing="0" class="container-for-gmail-android" width="100%">
<tr>
<td align="left" valign="top" width="100%" style="background:repeat-x url(http://s3.amazonaws.com/swu-filepicker/4E687TRe69Ld95IDWyEg_bg_top_02.jpg) #ffffff;">
<center>
<img src="../ATemplate/assets/images/newly.png" />
</center>
</td>
</tr>
<tr>
<td align="center" valign="top" width="100%" style="background-color: #f7f7f7;" class="content-padding">
<center>
<table cellspacing="0" cellpadding="0" width="600" class="w320">
<tr>
<td class="header-md">
Thank You For Registration <!--In [client]-->
</td>
</tr>
<tr>
<td class="free-text">Kindly retain below Registration Details for logging in future.</td>
</tr>
<tr>
<td class="mini-block-container">
<table cellspacing="0" cellpadding="0" width="100%" style="border-collapse:separate !important;">
<tr>
<td class="mini-block">
<table cellpadding="0" cellspacing="0" width="100%" class="table table-bordered">
<tr>
<th>Name</th>
<td>[name]</td>
</tr>
<tr>
<th>User Name</th>
<td>[user]</td>
</tr>
<tr>
<th>Email ID</th>
<td>[email]</td>
</tr>
<tr>
<th>Password</th>
<td>[pass]</td>
</tr>
<tr>
<th>Reg Date</th>
<td>[date]</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</center>
</td>
</tr>
<tr>
<td align="center" valign="top" width="100%" style="background-color: #f7f7f7; height: 100px;">
<center>
<table cellspacing="0" cellpadding="0" width="600" class="w320">
<tr>
<td style="padding: 25px 0 25px">
<strong>Coppyright </strong> Whizsoftwares.com
</td>
</tr>
</table>
</center>
</td>
</tr>
</table>
the mail is sending like this:
but i want to bind this template:
You can read the template as a string and then replace the text you want and the email body needs to be proper HTML starting and closing with tag. You should also use the string builder to construct your template.
var emailBody = new StringBuilder("<html><body>");
emailBody.Append(File.ReadAllText(Server.MapPath("~/EmailTemplate/EmailTemplate.html")));
emailBody.Replace("[name]", ... );
emailBody.Append("</body></html>");
mm.Body = emailBody.ToString();

Inline CSS is not working with gem 'htmltopdf'

My requirement is to download docx file and should be open on Microsoft word:
I am using following gems:
gem 'responders'
gem 'htmltoword
Controller code:
require 'htmltoword'
class Admin::VisibilitiesController < ApplicationController
respond_to :docx, :html, :css,:js
def preview
#project = Project.find_by(id: params[:id])
#feeder = Project.find_by(id: params[:id]).form2.last.feeder11s.first
respond_to do |format|
format.docx do
render :docx => "report1_docx",:template => 'admin/visibilities/preview.html.docx.erb', :page_height => 600, :page_width =>345
end
end
end
View file code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
<style type="text/css">
div.alwaysbreak { page-break-before: always; }
div.nobreak:before { clear:both; }
div.nobreak { page-break-inside: avoid; }
td{padding: 2px 5px;}
</style>
<div style="padding-top:20px;">
<table style="width:800px;margin:0px auto;border:1px solid grey; background: #fff;margin: 0 auto;margin-bottom:30px;padding:10px 20px; ">
<tbody>
<tr>
<td style="padding: 15px 0 50px;">
<table style="padding:0px;overflow:hidden;display:table;">
<tbody>
<tr>
<td style="font-size: 16px;width:100%;font-weight:600">
Report No......./...../......./20116-17.....
</td>
</tr>
<tr>
<td style="font-size: 16px;width:100%;font-weight:600">
Dated: ......
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="font-size:28px;font-weight:bold;text-align:center;padding-bottom:20px; font-style: italic;">THIRD PARTY VILLAGE INSPECTION REPORT</td>
</tr>
<tr>
<td style="font-size:28px;font-weight: bold;text-align:center;padding-bottom:25px; font-style: italic;">OF</td>
</tr>
<tr>
<td style="font-size:24px;font-weight:400;text-align:center;padding-bottom:25px;">RURAL ELECTRIFICATION WORKS UNDER DEEN DAYAL UPADHYAYA GRAM JYOTI YOJANA (erstwhile RGGVY 12TH PLAN)</td>
</tr>
<tr>
<td style="font-size:24px;font-weight:400;text-align:center;padding-bottom:20px;">IN</td>
</tr>
<tr>
<td style="font-size:24px;font-weight:400;text-align:center;padding-bottom:25px;">..............DISTRICT</td>
</tr>
<tr>
<td style="font-size:24px;font-weight:400;text-align:center;padding-bottom:20px;">SUBMITTED TO</td>
</tr>
<tr>
<td style="font-size:24px;font-weight:400;text-align:center;padding-bottom:25px;">........................</td>
</tr>
<tr>
<td style="font-size:24px;font-weight:400;text-align:center;padding-bottom:20px;">SUBMITTED BY </td>
</tr>
<tr>
<td style="font-size:24px;font-weight:400;text-align:center;padding-bottom:30px;">........................</td>
</tr>
<tr>
<td style="font-style: italic; padding-bottom: 30px; padding-top: 100px;">
<table style="width: 100%; margin-top: 50px;">
<tr>
<td style="font-size:12px;padding-bottom:10px;font-weight:600">Report No (admin)/District(survey)/1st/2016-17/070</td>
<td style="font-size:12px;padding-bottom:10px;font-weight:600; text-align: right;">Dated: from survey (form1)</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="padding-bottom: 50px;">
<table style="width: 100%;">
<tr>
<td style="font-size:18px;font-weight:600">Location:</td>
</tr>
<tr>
<td style="font-size:16px;font-weight:600">Name of Village : <%= #project.form1.try(:village_name) %></td>
<tr>
<td style="font-size:16px;font-weight:600">Census Code No : <%= #project.form1.try(:census_code_no) %>
</td>
</tr>
<tr>
<td style="font-size:16px;font-weight:600">Name of Block : <%= #project.form1.try(:block_name) %></td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</body>
</html>
Output
htmltoword gem currently provides just some basic styling support mostly on alignment and tables.
Here is opened GitHub issue https://github.com/karnov/htmltoword/issues/45 about that problem.
And here is the doc describing supported styles and classes.
Try to use some basic HTML tags instead of CSS-styles where it is possible, it seems the only way at the moment to get your word doc to be styled.

How to set website logo image on signup mail in rails?

I am using rails 5 when user is registered in my website i am sending an email for him for account approval.I want to set website logo with email.
How we implement this in rails mailer view file
Html for mail template
<!DOCTYPE HTML>
<html>
<title>nytApp Email</title>
<head>
</head>
<body style="font-family: 'arial', sans-serif !important; font-size: 14px; line-height: 20px; color:#3e3e3e; background-color: #f5f5f5; font-weight: 300;">
<!-- Container Table -->
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td>
<table cellpadding="0" cellspacing="0" width="640" style="margin:0 auto; background:#fff;">
<tr>
<td style="border: 1px solid #f5cd8f;">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="padding: 25px 15px 20px; border-bottom: 1px solid #f5cd8f;">
<table align="center" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td><%= image_path('logo.png')%></td>
<td>
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="font-weight: bold; font-size: 16px;">
<tr>
<td style="color: #ff5e00; font-weight: 300; font-size: 20px;">Welcome to Nytapp</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="padding: 0 15px 20px;">
<table align="center" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr><td height="10"></td></tr>
<tr>
<td>Thank you for signing up as Events Promoter!</td>
</tr>
<tr><td height="25"></td></tr>
<tr>
<td>You are ready to start posting your parties for free. Login to the portal by clicking on the link below:</td>
</tr>
<tr><td height="10"></td></tr>
<tr>
<td>https://nytapp.com</td>
</tr>
<tr><td height="10"></td></tr>
<tr>
<td>If the above URL does not work try copying and pasting it into your browser.</td>
</tr>
<tr><td height="8"></td></tr>
<tr>
<td>If you encounter any problem, please contact us at admin#nytapp.com</td>
</tr>
<tr><td height="25"></td></tr>
<tr>
<td>Thank you,</td>
</tr>
<tr>
<td>The Nytapp team</td>
</tr>
<tr><td height="30"></td></tr>
</table>
</td>
</tr>
<tr>
<td style="border-top: 1px solid #f5cd8f; vertical-align: middle; padding: 10px 15px;">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td>
<%= image_path('logo.png') %>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
In mailer you can't give relative path. So try upload your logo somewhere in cloud like s3 and give complete logo url in image tag source.
You can also use asset_url it compute complete url.
<%= image_tag asset_url('logo.png') %>
In your html.erb file which is suppose to be send as mail
you need to wrtte something like this.....
<img src=" <%= Rails.application.secrets.host + "" + asset_path("sd_logo.png") %>"

Not able to show committers list in Jenkins Jelly email template

We have recently migrated our jenkins to 1.6 version and I have findbug project set. While showing findbug results in email using below jelly template, "Find Bugs warnings info" section shows error message as "Find Bugs Publisher did not get invoked due to an error". But I do not see any error in console.
Also, "New Warnings" section is not showing up. It looks that fb variable is null and no results are showing up in email template.
Even the change sets section is not visible.
Is there any setting missing for findbug in Jenkins required to show up these results.
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define">
<html>
<head>
<title>${project.name}</title>
<style>
body table, td, th, p, h1, h2 {
margin:0;
font:normal normal
90% Georgia, Serif;
background-color: #ffffff;
}
h1, h2 {
border-bottom:dotted 1px #999999;
padding:5px;
margin-top:10px;
margin-bottom:10px;
color: #000000;
font: normal bold 90%
Georgia,Serif;
background-color:#f0f0f0;
}
</style>
</head>
<body>
<div class="header">
<j:set var="spc" value="&nbsp;&nbsp;" />
<h1>
<j:choose>
<j:when test="${build.result=='SUCCESS'}">
<img src="${rooturl}static/e59dfe28/images/32x32/blue.gif" />
</j:when>
<j:when test="${build.result=='FAILURE'}">
<img src="${rooturl}static/e59dfe28/images/32x32/red.gif" />
</j:when>
<j:otherwise>
<img
src="${rooturl}static/e59dfe28/images/32x32/yellow.gif" />
</j:otherwise>
</j:choose>
BUILD ${build.result}
</h1>
<table>
<tr>
<td>Build URL</td>
<td>
${rooturl}${build.url}
</td>
</tr>
<tr>
<td>Project:</td>
<td>${project.name}</td>
</tr>
<tr>
<td>Date of build:</td>
<td>${it.timestampString}</td>
</tr>
<tr>
<td>Build duration:</td>
<td>${build.durationString}</td>
</tr>
<tr>
<td>Build cause:</td>
<td>
<j:forEach var="cause" items="${build.causes}">${cause.shortDescription}
</j:forEach>
</td>
</tr>
<tr>
<td>Build description:</td>
<td>${build.description}</td>
</tr>
<tr>
<td>Built on:</td>
<td>
<j:choose>
<j:when test="${build.builtOnStr!=''}">${build.builtOnStr}
</j:when>
<j:otherwise>master</j:otherwise>
</j:choose>
</td>
</tr>
</table>
</div>
<!-- Static Analysis -->
<j:set var="actions" value="${it.staticAnalysisActions}" />
<j:if test="${!actions.isEmpty()}">
<div class="content">
<h1>Static Analysis Results</h1>
<table>
<tr>
<th></th>
<th>Name</th>
<th>Result</th>
<th>Total</th>
<th>High</th>
<th>Normal</th>
<th>Low</th>
</tr>
<j:forEach var="action" items="${actions}">
<tr>
<td>
<img src="${rooturl}${action.smallImageName}" />
</td>
<td>
<a href="${rooturl}${build.url}/${action.urlName}">${action.displayName}
</a>
</td>
<td class="center">
<j:choose>
<j:when test="${action.result.pluginResult=='SUCCESS'}">
<img src="${rooturl}static/e59dfe28/images/16x16/blue.gif" />
</j:when>
<j:when test="${action.result.pluginResult=='FAILURE'}">
<img src="${rooturl}static/e59dfe28/images/16x16/red.gif" />
</j:when>
<j:otherwise>
<img src="${rooturl}static/e59dfe28/images/16x16/yellow.gif" />
</j:otherwise>
</j:choose>
</td>
<td class="center">${action.result.numberOfAnnotations}
</td>
<td class="center">${action.result.getNumberOfAnnotations('HIGH')}
</td>
<td class="center">${action.result.getNumberOfAnnotations('NORMAL')}
</td>
<td class="center">${action.result.getNumberOfAnnotations('LOW')}
</td>
</tr>
</j:forEach>
</table>
</div>
</j:if>
<!-- More Find bugs info-->
<j:set var="fb" value="${it.getAction('hudson.plugins.findbugs.FindBugsResultAction')}" />
<div class="content">
<h1>Find Bugs warnings info</h1>
<table width="100%">
<tr>
<th>Total</th>
<th>Fixed</th>
<th>New</th>
<th >Report</th>
</tr>
<tr>
<td class="center">${fb.result.numberOfWarnings}</td>
<td class="center">${fb.result.numberOfFixedWarnings}</td>
<td class="center">${fb.result.numberOfNewWarnings}</td>
<td class="center">View Report</td>
</tr>
</table>
</div>
<j:set var="newWarnings" value="${fb.result.newWarnings}" />
<j:if test="${newWarnings!=null}">
<div class="content">
<h1>New warnings</h1>
<table width="100%" class="newWarningsborder">
<tr>
<th width="20%" class="newWarningsborder">Name</th>
<th width="5%" class="newWarningsborder">Line</th>
<th width="*" class="newWarningsborder">Message</th>
</tr>
<j:forEach var="fileAnnotation" items="${newWarnings}" varStatus="loop">
<tr>
<td width="20%" class="newWarningsborder">${fileAnnotation.shortFileName}</td>
<td width="5%" class="newWarningsborder">${fileAnnotation.primaryLineNumber}</td>
<td width="*" class="newWarningsborder">${fileAnnotation.message}</td>
</tr>
</j:forEach>
</table>
</div>
</j:if>
<!-- CHANGE SET -->
<div class="content">
<j:set var="changeSet" value="${build.changeSet}" />
<j:if test="${changeSet!=null}">
<j:set var="hadChanges" value="false" />
<a href="${rooturl}${build.url}/changes">
<h1>Changes</h1>
</a>
<j:forEach var="cs" items="${changeSet.logs}" varStatus="loop">
<j:set var="hadChanges" value="true" />
<h2>${cs.msgAnnotated}</h2>
<p>
by
<em>${cs.author}</em>
</p>
<table>
<j:forEach var="p" items="${cs.affectedFiles}">
<tr>
<td width="10%">${spc}${p.editType.name}</td>
<td>
<tt>${p.path}</tt>
</td>
</tr>
</j:forEach>
</table>
</j:forEach>
<j:if test="${!hadChanges}">
<p>No Changes</p>
</j:if>
<br />
</j:if>
</div>
<!-- ARTIFACTS -->
<j:set var="artifacts" value="${build.artifacts}" />
<j:if test="${artifacts!=null and artifacts.size()>0}">
<div class="content">
<h1>Build Artifacts</h1>
<ul>
<j:forEach var="f" items="${artifacts}">
<li>
${f}
</li>
</j:forEach>
</ul>
</div>
</j:if>
<!-- MAVEN ARTIFACTS -->
<j:set var="mbuilds" value="${build.moduleBuilds}" />
<j:if test="${mbuilds!=null}">
<div class="content">
<h1>Build Artifacts</h1>
<j:forEach var="m" items="${mbuilds}">
<h2>${m.key.displayName}</h2>
<j:forEach var="mvnbld" items="${m.value}">
<j:set var="artifacts" value="${mvnbld.artifacts}" />
<j:if test="${artifacts!=null and artifacts.size()>0}">
<ul>
<j:forEach var="f" items="${artifacts}">
<li>
${f}
</li>
</j:forEach>
</ul>
</j:if>
</j:forEach>
</j:forEach>
<br />
</div>
</j:if>
</body>
</html>

Campaign Monitor importing template: unsubscript tag not found

I try to import an email-template in campaign monitor, but it shows always the same problem:
No unsubscribe link We require a single-click unsubscribe link in every campaign you send. Please add the tags and around the words you want to become an unsubscribe link.
What I do not understand is, that I have the tag in my template:
<layout label="POST-FOOTER25">
<table width="100%" bgcolor="#fff" cellpadding="0" cellspacing="0" border="0" id="backgroundTable">
<tbody>
<tr>
<td width="100%">
<table width="600" cellpadding="0" cellspacing="0" border="0" align="center" class="devicewidthinner">
<tbody>
<!-- Top Spacing -->
<tr>
<td width="100%" height="10" style="font-size: 0;line-height: 0;border-collapse: collapse;"> </td>
</tr>
<!-- Top Spacing -->
<tr>
<td width="100%">
<table width="560" cellpadding="0" cellspacing="0" border="0" align="center" class="devicewidthinner">
<tbody class="">
<tr class="">
<td width="100%" align="right" valign="middle" style="font-family: 'Open Sans', Arial, sans-serif; font-size: 12px; line-height: 16px; color: rgb(62, 69, 76); text-align: center; font-weight: 400;" mgedit="text" class="aligncenter">
<multiline label="text617_86">
<!--[if !mso]><!-->
<span style="font-family: 'Open Sans', Arial, sans-serif;">
<!--<![endif]-->
You are receiving this email because you subscribed for updates on our website. <unsubscribe>Click here to Unsubscribe</unsubscribe><br /><br />
<preferences>Manage your subscription</preferences>
<!--[if !mso]><!-->
</span>
<!--<![endif]-->
</multiline>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<!-- Bottom Spacing -->
<tr>
<td width="100%" height="10" style="font-size: 0;line-height: 0;border-collapse: collapse;"> </td>
</tr>
<!-- Bottom Spacing -->
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</layout>
There is no comment or if-case around the unsubscribe-tag. Any other idea?
Greets, yab86
I'd recommend moving the unsubscribe and preferences markup out of the multiline markup area. It's likely their system doesn't recognize it because it's put into the editable multiline WYSIWYG Editor

Resources