I am working on app in elixir. It sends email to clients. I am using bamboo library for sending emails.
So far, emails are working fine. But now, I am trying to send emails using templates.
Everywhere i see in the bamboo documentation is using
bamboo.phoenix .
I am not using phoenix for handling requests. I am using a library called plug. Is there a way to send templates in email without phoenix ??
Adding answer to this post with the help #JustMichael comment.
Directory structure -
/priv
/static
/test.html.eex
Function used :
new_email
|> to("vivek29vivek#gmail.com")
|> from(#from_email)
|> subject("test")
|> html_body(EEx.eval_file("priv/static/mail_templates/#test.html.eex",[foo: "bar"])) //this will render the template.Also can pass variables
test.html.eex
<h3>Foo: <%= foo %></h3>
But , we cannot add css just by adding <link rel="stylesheet" href="styles.css"> . I guess, There is a need for static server.
Do comment if there is another way to add css apart from inline css.
Related
I'm using Azure AD B2C / IEF Custom Policies. As part of my Password Reset user journey, I want to use SendGrid to handle the email for the OTP / verification code. I also want to use custom HTML templates for the password reset page(s). The Azure docs give a good example for using SendGrid... BUT it uses DisplayControl elements to format the password reset page and it's not immediately obvious how to augment or replace the DisplayControl element to instead use Custom HTML.
Did anyone manage to get this working? Any pointers?
TIA
EDIT: Is it simply a case of adding a LoadUri element to the ContentDefinition that contains the DataUri?
Actually, it turns out that the DisplayControl works fine. It forms part of the HTML that is dynamically generated and injected into the Custom Template HTML ("App" element) by B2C.
Initially I was getting Server 500 errors from B2C, which lead be to believe there was a problem with the approach - but the I found the source of the errors elsewhere and once fixed, the DisplayControl components worked pretty seemlessly
So currently I am in the process of setting up notifications, and what I had wanted to send in my message portion was the url for the artifact zip file that was created.
I took a look at the default payload (https://www.appveyor.com/docs/notifications/#webhook-payload-default) and was able to send {{jobs}} which gave me in the email this:
System.Collections.Generic.List`1[Appveyor.Models.BuildJobNotificationTemplateData]
I figured I could traverse this in my messaging template. However, when I tried to do that it kept erroring out with different methods that I’ve tried.
Some of them include :
{{jobs[0].artifacts[0].url}}
{{jobs.artifacts.url}}
{{eventData.jobs.artifacts.url}}
{{eventData.jobs[0].artifacts[0].url}}
Etc…
What would the proper syntax be to grab the first artifacts url using the templating engine?
This syntax will work (see mustache template to understand the syntax)
<p>Artifacts:</p>
<ul>
{{#jobs}}
{{#artifacts}}
<li>{{url}}</li>
{{/artifacts}}
{{/jobs}}
</ul>
But unfortunately it will return temporary Azure blob storage URL, which will expire in 60 minutes. Please watch https://github.com/appveyor/ci/issues/1646. For now to get permanent URL please use this workaround
Thank you in advance for any and all help.
I've been having a ridiculous issue with trying to get my rails 4 app to take in data from an email parsing API that sends an XML response to a specified url within my application. For whatever reason I can't seem to find, the data is not getting into my application via the HTTP Post from the API.
When I test out using requestb.in and Advanced Rest Client everything works great, however when I try to send the data to my app, no dice. I'm currently sending to my dev branch via Pow.cx so it has a specific url to send to. I've been testing using google's Advanced Rest Client and requestb.in and using requestbin I've had no problem getting the data to show up on Advanced Rest Client, however it will not get into my App. Any help will be super appreciated. Thank you!!
My Routes:
get 'worldmate/receive', to: 'worldmate#receive'
post 'worldmate/receive', to: 'worldmate#receive'
In My Controller:
require 'nokogiri'
require 'net/http'
require 'open-uri'
require 'json'
class WorldmateController < ActionController::Base
def receive
#request = request
#xml = #request.body
#string = #request.body.read
#size = #request.body.size
end
My erb:
<p> Request: <%= #string %> <p>
<br>
<p> Less Detailed Request: <%= #xml %> </p>
<br>
<p> Size: <%= #size %> </p>
I have no idea why my app isn't taking this data in. When I send a post request using Advanced Rest Client it works totally fine. Any and all help is SUPER appreciated. Many thanks.
My guess is that you have configured your email parsing service to POST the data to a URL which is only accessible from your local system, for instance a pow.cx style ".dev" URL.
The reason this works using your test utility is I'm assuming the test client is also on your local machine and therefore your local server is addressable from there.
The way I've worked around this is using tunneling. Ngrok is a nice, low-config tool for tunneling, but there are many solutions out there to make your local dev environment accessible from the web for testing purposes.
Problem :
In Gmail the email template is not viewed like
http://zurb.com/ink/downloads/templates/basic.html
it looks like a simple plain text mail with html tags, without color formatting
What I Tried :
Template Code Used : http://zurb.com/ink/downloads/templates/basic.html
Copy Pasted in Views\Layouts\Emails\html\default.ctp for a quick check & sent a test mail.
Their Test's says it should work on all major email emails
Test Result : https://litmus.com/pub/85a1b19
That is a nice layout - just not for emails.
For templates HTML emails all style must be inline - style tags are not allowed across many email clients.
Thus, you need to use something like I do to transform the style css into inline css upon sending:
https://github.com/dereuromark/tools/blob/master/Lib/InlineCssLib.php
Basically, upon generating the final template, an afterLayout() hook of a helper can trigger this.
See this discussion for details on the implementation.
Maybe the parameter ->emailFormat('text')?
ensure that you use ->emailFormat('html')
After a build is finished I use the mail-ext-plugin (Jenkins Email Extension Plugin) to send an email to certain users. I would like to include the user who started (requested) the build in that email. I have tried the suggestion here however, that didn't seem to work I just got this error.
Error in script or template: groovy.lang.MissingPropertyException: No such property: CAUSE for class: SimpleTemplateScript4
After much searching I found a page on jelly usage on the Jenkins wiki (here). There is a link on this page which contains all the useable classes. I was able to find the cause class and used this great example to help me implement it in my code. I added
<%
for (hudson.model.Cause cause : build.causes) {
%>
${cause.shortDescription}
<%
}
%>
which produced -
Started by user Matthew Armstrong