0

I have downloaded html email templates from the internet, but would like to know how to use the html template. The templates come with html and css files.

The downloaded files have a separate css folder. But I dont know how to refer to the css files from the html mail. I don't want to use inline css.

Please give me a few pointers.

(Edit: I do not want to write any code in Java or PHP)

user11221
  • 11
  • 5
  • see http://stackoverflow.com/questions/5223079/how-to-send-html-email – Pramod S. Nikam May 09 '14 at 06:48
  • and http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/javamail/javamail.html – Pramod S. Nikam May 09 '14 at 06:48
  • I suggest you check out some of these [html email resources](http://stackoverflow.com/questions/2229822/html-email-best-practices-considerations-and-how-to-write-code-for-outlook-gma/21437734#21437734). You are asking for things that shouldn't be done in html email, so it will help you get up to speed on the limitations. – John May 09 '14 at 07:54

3 Answers3

1

You can't link to external style sheets in email. You need to include it in the html page. Additionally you should inline it as some clients (Gmail in particular) strip all the CSS from your <style> tags.

Typically you shouldn't send html emails from your own email client, and I would suggest you use a service like Mailchimp or Campaign Monitor. The hacky workaround to send html yourself though, is to view your rendered html in a web browser then ctrl+a copy the rendered page and paste it into your email body. Far from best practice, but it works.

You will also need your images hosted somewhere online, otherwise they will not load for the recipient.

John
  • 11,985
  • 3
  • 45
  • 60
0
<html>
<body>

<h3>Send e-mail to abc@sample.com</h3>

<form action="MAILTO:abc@sample.com" method="post" enctype="text/plain">
Name:<br>
<input type="text" name="name" value="your name"><br>
E-mail:<br>
<input type="text" name="mail" value="your email"><br>
Comment:<br>
<input type="text" name="comment" value="your comment" size="50"><br><br>
<input type="submit" value="Send">
<input type="reset" value="Reset">
</form>

</body>
</html>
Mustafa sabir
  • 4,130
  • 1
  • 19
  • 28
0

Since you want to send HTML email from your Gmail account and don't want to write Java or PHP, I suggest you check out Google AppScripts.

Inside the AppScripts editor, you can create the HTML template and send it as is using the following code.

 var htmlEmailBody = HtmlService.createTemplateFromFile('html-template-name');

  var subject = "Welcome to Google AppScripts";
  var toAddress = "xyz@xyz.com";
  var normalBody = "This is the normal plaintext version of the html email";

    GmailApp.sendEmail(toAddress, subject, normalBody, {
      htmlBody : htmlEmailBody.evaluate().getContent()
    });

  }

However, there are several things to follow when sending an HTML email like inlining all CSS styles, using table layouts, and more. I suggest you read my article on the same here.

Head over to script.google.com to start writing your first AppScript.

Shan Eapen Koshy
  • 2,909
  • 1
  • 28
  • 40