473,395 Members | 1,497 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Adding a css template to java mail

19
Hi,

I'm trying to send mail from our application using java mail api. There is
a .css file which i need to use for it. How can i do it?????

The problems i faced are :
I tried to get the .css file through Datasource and add it to the body
part with a content id and tried to call it from the html code using cid.
And i found that the .css file is attached to the mail, not templated.
Also inside the .css file i used cid
to access an image and it also came as an attachment. I need to know
how to add a .css template to the mail????

I can send the code if needed.

Thanks in advance.
Nov 23 '09 #1
2 8678
Frinavale
9,735 Expert Mod 8TB
I think you're going to have to read the contents of the CSS file and add it to the <head><style>...</style></head> section of the HTML that makes up the body of your email.

I haven't tried this myself but I think that would be how it would have to go.

-Frinny
Nov 23 '09 #2
Its been around a week.I have been working on this java mail .even I tried a lot to use css file in my html file in every possible way.I found Two possible way of doing it.
1) you can attach the CSS file as an attachement and in HTML you can reference it using "cid:style.css".
2)you can include the whole CSS script in body section of HTML file.

In both cases,for some clients it will work fine and for some it wont.I tried to use 2nd case.HTML page got displayed fine in yahoo mail,but in gmail it didn't work.
If your CSS is not much complicated then it may work(in gmail too).but it will be headache after all.

Later I came to know that some clients like gmail avoid the attached css file .It also avoids the content between head section in HTML file. so the best thing is try to avoid using css file.use inline style.
By the way, its just matter of one html page.so you can avoid..:)
Feb 27 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
4
by: Kevin Dean | last post by:
I'm trying to create an XSL transformation that will strip out development-specific attributes from deployment descriptors and other XML files. I have already successfully done so with web.xml but...
11
by: Guotao Luan | last post by:
Hello All: I notice that there have been frequent questions being asked about template here so I guess it is okay to post this message here. I just wrote a c++ tempalte tutorial/review, I would...
5
by: Gonçalo Rodrigues | last post by:
Hi all, (note: newbie alert) Suppose you have a hierarchy of objects that you deal with via smart pointers, e.g. something like: template<typename T> class Ref { private:
5
by: Vijai Kalyan | last post by:
Hello, I have come back to C++ after a couple of years with Java so I am quite rusty and this question may seem poor: My platform is Windows XP with MSVC 7.1. I have a class with a...
8
by: coosa | last post by:
Dear all, I have the following code: #include <iostream> #include <string> #include <sstream> using namespace std;
6
by: desktop | last post by:
I am trying to understand the following template: template <typename T> inline T const& max (T const& a, T const& b) { return a < b ? b : a; } does it say that the function max returns a...
2
by: Pierre Yves | last post by:
Hi there, Sorry for the double subject but I feel they are related. I'm not pretty sure there would be an answer but I reckon there must be a way to make it work. I would like to write the...
3
by: Daniel Pitts | last post by:
I have a Vector template class (math vector), where the number of dimensions is one of the template parameters. template<typename component_t, int dimensions> class Vector {...} I'd like to...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.