email,templates,go,mandrill , Mail with html content shows break lines or ignores newlines


Mail with html content shows break lines or ignores newlines

Question:

Tag: email,templates,go,mandrill

I am sending mail to users via mandrill and I using both smtp and mandrill api to send. Content of the mail is rendered go template (.tpl) When I put template like

Hi {{.name}},
<br/>
This is support.  
<br/>

it sends via mandrill api ok, but
is visible when I send via smtp, when use template like ( <br/> replaced with \n)

Hi {{.name}},

This is support.  

mandrill ignores that and shows everything in one line but smtp shows ok newlines. What is a solution for this ?

I am rendering template like

frame, err := template.New("foo").Parse( *templateString )
if err != nil {
    return nil, err
}
var doc bytes.Buffer
frame.Execute( &doc, *parameters )
temp := doc.String()

Answer:

Are you sending the mail as HTML? If so, you can wrap everything in the <pre> tag.

If you're not using HTML, setting this header should help: Mime-Type: text/plain

Also, try changing your newlines from \n to \r\n.


Related:


Outlook VBA - set sentonbehalf and Refresh ActiveInspector


vba,email,outlook,outlook-vba
I frequently want to change the sender data in the currently open Mail This is well done by following code: Sub AktiveMailSetVonHotline() Dim oMail As Outlook.MailItem Set oMail = ActiveInspector.CurrentItem oMail.SentOnBehalfOfName = "[email protected]" End Sub` Only question / disadvantage is: After running that macro I can not see that the...

How do you unblock the 993 port if your firewall settings is blocking it?


php,email,ssl
I am trying to retrieve my emails from Gmail using php. for writing the host name, this is my code: $hostname = '{imap.gmail.com:993/imap/ssl}INBOX'; I am getting this error: Warning: imap_open(): Couldn't open stream {imap.gmail.com:993/imap/ssl}INBOX in /home1/mtc/public_html/mtcerp/emailparser/email.php on line 10 Cannot connect to Gmail: Can not authenticate to IMAP server: [CLOSED]...

Explicit instantiation of class template not instantiating constructor


c++,templates,constructor,explicit-instantiation
I'm working on a project in C++ and am having trouble understanding what members of a template class get explicitly instantiated when I explicitly instantiate the template class. I've written the following file, which I then compile using Visual C++ 2008 Express Edition's Release configuration and then pop into a...

Partial specialization of nested template types produces “internal error” in VC++ 2012 compiler


c++,templates,visual-studio-2012,nested
In the following example, I have an object class which defines a reference class. Both accept mutability as a template argument. In the case that 'obj' is 'Const', I want to disallow a reference of type 'Non_Const'. The example produces the ambiguous message, "An internal error has occurred in the...

semicolon separated email validation in javascript only [duplicate]


javascript,regex,email
This question already has an answer here: Using a regular expression to validate an email address 65 answers I know there are so many repeated questions in stack but i didn't found any help, so please help me. Email should be like this, "[email protected];[email protected]; [email protected] ; [email protected] ;[email protected];" I...

Confused about returns in stack template


c++,templates,generic-programming
I'm implementing a generic stack (with an array) in C++ and am confused about what to return in this situation: template <class T> T Stack<T>::pop(void) { if (size != 0) { return items[size - 1]; size--; } else { cerr << "Cannot pop from empty stack." << endl; return ???;...

c++: Passing objects to functions


c++,templates,object
I was going through a code where I encountered some problem and was able to crack this piece of code: #include <iostream> #include <stdint.h> #include <unistd.h> #include <errno.h> #include <vector> #include <sys/types.h> using namespace std; class abc { public: abc(int x,int y) { cout << "x:" << x << endl;...

decltype does not resolve nested vectors. How can I use templates for nested vectors?


c++,templates,vector,nested
I am trying to overload the + operator to deal with nested vectors. I thought the function would call itself until the nested vectors resolve to basic types, but instead I get a huge list of errors when I compile it. My vector operations that I have defined work for...

Wordpress Custom Post type archive display


wordpress,templates,custom-post-type,advanced-custom-fields
I have a custom post type named STORIES. Within that post type, I have categories, so each STORY is also assigned a category like this... Story 1 (assigned category RED) Story 2 (assigned category BLUE) Story 3 (assigned category GREEN) etc. I need to display a page which lists the...

How can I access item in parent repeat template while in filter


javascript,html,templates,polymer
<iron-pages> <template is="dom-repeat" items="{{fruit_categories}}" as="category"> <div> <template is="dom-repeat" items="{{all_fruits}}" as="fruit" filter="isThisFruitInTheRightCategory"> <!-- Some more stuff --> <span>{{fruit.weight}}</span> <span>{{fruit.age}}</span> <!-- ... --> </template> </div> </template> </iron-pages> isThisFruitInTheRightCategory: function(fruit){ return fruit.category === /* Q: How do I get the current category? */ } Suppose I...

C++ Will using a pointer to the same function as a template parameter always lead to the same instantiation?


c++,templates,function-pointers
I have a template function taking a function pointer as an argument, and a normal function like so: template <void()> int foo() {static int c = 0; return ++c;} void bar() {} If I understand correctly, two different function pointers can have different binary representations, even if using them would...

Laravel 4.2 Sending email error


php,email,laravel,laravel-4
Hello everyone I have an error in laravel when I am sending an email. I have a form with a select tag and when I select the user and click submit I need to send him a mail after I select it. Here is my Controller method: public function store()...

C++ why does SFINAE fail with only a class template parameter?


c++,templates,c++11,sfinae
I'm using SFINAE in the style of this answer in order to call a generic vector object by using an appropriate member function. For example, the following code calls operator[](int) const first, and if that doesn't exist then operator()(int) const: template<int I> struct rank : rank<I-1> { static_assert(I > 0,...

How to send a mail by postfix mail server with rails?


ruby-on-rails,email,mailer
On my local host, I followed this article made a mail server and it works well. https://www.digitalocean.com/community/tutorials/how-to-install-postfix-on-centos-6 I want to develop a mailer feature with rails framework. Here are my settings: # mailer config.action_mailer.default_url_options = { :host => 'example.com' } config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { address: 'localhost', port: 25,...

Type function that returns a tuple of chosen types


c++,templates,c++11,metaprogramming
I've implemented a type function Tuple that turn a list of My_enum values into an std::tuple of corresponding types: #include <tuple> enum My_enum{ t_int, t_double }; // Bind_type is a type function that given a My_enum returns the corresponding type template<My_enum E> struct Bind_type; template<> struct Bind_type<t_int>{ using type =...

C++ template template


c++,templates
I'm trying to understand C++ template templates by implementing a generic container class. Here is the code: using namespace std; template <typename T, template <typename STORETYPE> class Container> class Store { public: ~Store() {}; Store() {}; void someFunc( const T & ) {}; //... private: Container<T> storage; }; int main(int...

C++ error: deduced conflicting types for parameter 'T' string vs const char *


c++,string,templates,c++11,char
So, I am writing a simple, templated search function for deque container. Here's the code: template <typename T> void searchInDequeFor(std::deque<T> Deque, T searchValue) { for(const auto & element : Deque) { if(Deque.empty()) { std::cout << "Deque is empty, nothing to search for..." << "\n"; } else if(element==searchValue) { std::cout <<...

SMTP Sendmail With PEAR not using formating from database


php,mysql,email
I am using PEAR to send an email with smtp authentication. Currently i store the email with formatting in a database and then send it out from there. The email is sending perfectly. But the email body is not being formatted. instead it is taking whatever is in the database...

pyramid_mako not finding templates. is there a hook to find the directory / file being called?


python,templates,mako
This one is really really buggging me. Will start by saying that everything is working perfectly on my local machine. On the server however, whatever I do ends up in a "Can not locate template for uri: ..." On my local machine I use a Linux VM on Mac OS...

template template class specialization


c++,templates,template-specialization
I am just learning about Template Template class specialisation. Not a big problem to explain in detail. From my understanding std::uniform_int_distribution is a template whereas std::uniform_int_distribution<Type> is the full specialisation of uniform_int_distribution giving a type. I pass this in the specialisation class template as follows below Main class template <template...

JavaMail MimeMessage.getContent unsupported encoding


email,encoding,javamail
I´m having a problem with parsing some type of mail encoding with charset=t.101-g2 I´m using JavaMail in Grails directly using the lib, getting the unread emails from IMAP, and for each message try to get the content with Object msgContent = msg.getContent() And that line is throwing the error. The...

Overloading Assignment operator in template based class


c++,templates,type-conversion,operator-overloading,template-meta-programming
I am writing a library to support a type of integers which have two template parameters INT_BITS and FRAC_BITS. I was successful in writing a convert function to convert different class types from one to another [ which vary in values of INT_BITS and FRAC_BITS ]. But when I try...

Combining multiple template classes to one class using typedef


c++,templates,macros,typedef
I have the following piece of code. Let us have the function declaration and implementation seperate. #include <iostream> class Y1 {}; class Y2 {}; template <class T1, class T2> class A { public: explicit A(); void foo() const; int bar() const; }; template <class T1, class T2> A<T1, T2>::A() {}...

Mail with html content shows break lines or ignores newlines


email,templates,go,mandrill
I am sending mail to users via mandrill and I using both smtp and mandrill api to send. Content of the mail is rendered go template (.tpl) When I put template like Hi {{.name}}, <br/> This is support. <br/> it sends via mandrill api ok, but is visible when I...

PHPMailer not sending e-mail through Gmail, returns blank page


php,email,gmail,phpmailer,send
I am trying to set up a contact form at the bottom of my page. I am using PHPMailer and trying to receive emails at my gmail account. Every time I submit the form, my url changes to url/email.php and I get a blank page. What am I doing wrong?...

Codeigniter PHP Mailer, Sender Info


php,email,codeigniter-2,phpmailer,contact-form
I'm using Codeigniter PHP Mailer which is hosted here: https://github.com/ivantcholakov/codeigniter-phpmailer/ and with gmail smtp it works flawless. However,using it for a standard contact form, when visitors use that contact form and send us an email, they basically send mails from our mail address to our another mail addess. When they...

C++: Store pointer to a member function of an object in another object


c++,templates,function-pointers,member-functions
I have a class which shall invoke a function specified by the user on certain occasions. Therefore the class has a method void setExternalPostPaintFunction(void(*function)(QPainter&)); that can be used to "register" a function. This function then will be called on that occasion: class A { public: void setExternalPostPaintFunction(void(*function)(QPainter&)); private: void (*_externalPostPaint)(QPainter&);...

PHP - how to send e-mail after successful file upload? [duplicate]


php,email,file-upload
This question already has an answer here: PHP mail form doesn't complete sending e-mail 10 answers I need a PHP to send an email if a file was uploaded successfully. My code is working fine like this: <?php $target_dir = "gallery-sys/"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $uploadOk = 1;...

Template C++: How to access iterator value for both std::map and std::set?


c++,templates,dictionary,stl,set
I have a specific search function. Because it's used on both std::set and std::map, it was duplicated in our code (not using template). I have to maintain those two functions, and I'd like to move them to a single function using a template (and then have only one search preocedure...

How do I access request parameters in kademi templates?


html,templates,velocity,kademi
I've been developing a website with Kademi and i'm trying to implement a date range search, I've got the date range adding parameters to the URL ?startDate=02/05/15&endDate=12/12/2015 But I don't know how to retrieve these values in kademi templates. How do I do this?...

Sending email using smtplib doesn't work anymore


python,email,smtplib
So yesterday I had this bit of code written out and it worked perfectly fine, but today it's not sending e-mails anymore. Can someone explain why? import smtplib SERVER = 'owa.server.com' FROM = '[email protected]' TO = ['[email protected]', '[email protected]'] name = 'Mr. Man' SUBJECT = 'Recent Information for: %s' % (name)...

Can we access Ember.TEMPLATES in controller?


javascript,templates,ember.js
Is it possible to use Ember.TEMPLATES to check the existence of a template within a controller or component? I am using v1.12.1 We are currently transitioning to a route that is rendering a template that may not exist. Prior to the transition, we need an existence check of the template...

constructor and templates


c++,templates,constructor
I was going through this piece of code where I came across a while calling this code from main #include <iostream> #include <vector> using namespace std; class abc { public: enum example { a=1, b=2, c=3, d=4 }; }; template<typename T> class xyz { public: xyz(T &v,abc::example ex=abc::a):b(v),len(sizeof(T)) { }...

Django template not found in main project directory error


python,django,templates
I am getting a 'template not found' error, although I've set up a correct template hierarchy (or so I thought) . ├── manage.py ├── twinja │   ├── admin.py │   ├── admin.pyc │   ├── __init__.py │   ├── __init__.pyc │   ├── migrations │   │   ├── __init__.py │   │   └── __init__.pyc │   ├──...

Passing a struct to a template with extern const. What is the extern for?


c++,templates,struct,const,extern
I am asking myself why the following code works and what the specifier extern does when instantiating baz_instance: struct baz { int value; }; extern const baz baz_instance = {3}; template<baz const& b> int foo(){ return b.value; } int main(){ foo<baz_instance>(); return 1; } Why does the above code compile...

Accessing shared outlook inbox in python


python,email,outlook
I have a shared inbox in outlook and I want to write some code that would get me the emails from the shared inbox. Right now I can get the emails from my main inbox, but I want to do it for another inbox. This is the code so far:...

Mapping const char * to duck-typed T at compile-time or run-time


c++,templates,c++11
I have many classes A, B, C, D, etc that are duck-typed and thus have the same methods and interface but do not inherit from the same class. E.g. class A { public: void foo(); void bar(); } class B { public: void foo(); void bar(); } class C {...

How to exclude guest users from getting emailed Rails 4 Devise


ruby-on-rails,email,ruby-on-rails-4,devise,mailer
Just set up my first mailer on Rails 4. I have a welcome email sent to new users as soon as they sign up (create) for a new account using devise. I also have devise set up so that if a current_user is not found, a guest user will be...

How to re-write templated function to handle type deduction


c++,templates,c++11
So, I have this search function for the map container: template <typename Key, typename T> void searchInMapByKey(std::map<Key,T> Map, T keyValue) { if(Map.empty()) { std::cout << "Map is empty, nothing to search for..." << "\n"; } else { for(const auto & element : Map) { if(element.first==keyValue) { std::cout << keyValue <<...

How do I send an email of the current page using a button?


javascript,php,html,email,xampp
I am trying to send an email of my html page. This is the code I have so far: <script language="javascript"> function emailCurrentPage() { window.location.href = "mailto:?subject=" + document.title + "&body=" + encodeURI(document.location); } </script> <button onclick="emailCurrentPage()">Email page</button> Which sends the link of the current page but I want the...

Call template function for the value of a pointer out of a template function, in C++


c++,templates,pointers,c++11
I am trying to call a template function for the pointer that was given as template parameter in my calling function. My code is: template <> struct serialize_helper<std::string> { // not important code... } }; template <class T> inline void serializer(const T& obj, StreamType::iterator& res) { if(std::is_pointer<T>::value) { //THIS doesn'...

Android URL connection java.io.FileNotFoundException


java,android,email,httprequest,bufferedreader
I try to send a normal Http Request to a WordlPress Website. This is the URL: "http://localhost.com/api/submit_comment/?post_id=12345&name=Max&[email protected]&content=hallo" If I open this with my Web-Browser all works fine. If I open it over this over an Android App it throws a java.io.FileNotFoundException. The Android Code: class SendComment extends AsyncTask<String, Void, String>...

Send email with body consisting of objects


email,powershell,foreach
I am trying to write a script to search through AD and look for any stale computers and then sends an email to me. However, there are 3 requirements: get the lastlogondate for any pc that is older than 90 days once I get that list, I do a ping...

I don't understand how the template function gets to be a friend of the class A::X::Y in the example in [namespace.memdef]/3 in C++14


c++,templates,language-lawyer,c++14,friend
Consider the following code from the example in [namespace.memdef]/3 in C++14: // Assume f and g have not yet been declared. void h(int); template <class T> void f2(T); namespace A { class X { friend void f(X); // A::f(X) is a friend class Y { friend void g(); // A::g...

Sending mail by Unauthorised sender in Google AppEngine


python,google-app-engine,email,sendmail
I've got a Google AppEngine Python application connected with my domain. I want to be able to send emails from any email, like: [email protected] So I use sendmail() and set mailobject.sender = "[email protected]", but it does not work. Also I made a receive function, but I don't want to receive...

How to use template within Django template?


python,html,django,templates,django-1.4
I have the django template like below: <a href="https://example.com/url{{ mylist.0.id }}" target="_blank"><h1 class="title">{{ mylist.0.title }}</h1></a> <p> {{ mylist.0.text|truncatewords:50 }}<br> ... (the actual template is quite big) It should be used 10 times on the same page, but 'external' html elements are different: <div class="row"> <div class="col-md-12 col-lg-12 block block-color-1"> *django...

c++: Two ways of declaring multiple templates


c++,templates
I have the following code: template<typename T> struct Pair3{ T first, second; Pair3() : first(T()), second(T()) {} Pair3(T first, T second) : first(first), second(second) {} Pair3(const Pair3<T>& in) : first(in.first), second(in.second) {} template<typename U> void copyFrom(Pair3<U> in); }; template<typename T> template<typename U> void Pair3<T>::copyFrom(Pair3<U> in){ first = in.first; second =...

How do I use VB.NET to send an email from an Outlook account?


vb.net,email
I'm trying to send an email via an outlook email account through a vb.net program. When I run the code I get an error telling me that I don't have a secure connection. I've been searching online and have tried all the adjustments I've found but I'm still not having...

How to add image slider in email newsletter?


javascript,jquery,html,email,newsletter
I have been created email newsletter using mailchimp Now i want to add image slider with responsive design, But i have been searched lot online.. Some online docs says can't able to add image slider in email newsletter. For example this link told., its impossible. So, may i know, what...