• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Sending a chart via email

Guest
Aug 13, 2007 Aug 13, 2007

Copy link to clipboard

Copied

Hi,
Would anyone know if it is possible to generate a cfchart in an email? I tried and it would not show in the email. I tried with gmail and with MS Outlook.

Below id the code I used:

<cfmail to="abc@abc.com" from="abc@abc.com" subject="chart test" type="HTML">
email start
<cfchart
xAxisTitle="Day"
yAxisTitle="Visitors"
font="Arial"
gridlines=6
showXGridlines="yes"
showYGridlines="yes"
showborder="yes"
show3d="yes"
chartHeight = "500"
chartWidth = "700"
XAxisType="date"
>

<cfchartseries type="bar" seriesColor="red" paintStyle="plain">
<cfchartdata item="1" value="100">
<cfchartdata item="2" value="200">
<cfchartdata item="3" value="300">
<cfchartdata item="4" value="250">
</cfchartseries>
</cfchart>
email end
</cfmail>
TOPICS
Advanced techniques

Views

506

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 13, 2007 Aug 13, 2007

Copy link to clipboard

Copied

shloime11 wrote:
> Hi,
> Would anyone know if it is possible to generate a cfchart in an email?

no, not possible.
but you could:
- first generate a jpeg-format chart and, using the NAME attribute of
<cfchart> tag assign it to a variable instead of displaying the chart
- use <cffile action="write" output="#yourcfchartvariablenamehere#"
file="fullpathtoyourfilehere" addnewline="no"> to save it as a jpeg image,
- and then attach that file to the email.
--

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 14, 2007 Aug 14, 2007

Copy link to clipboard

Copied

LATEST
You can also embed it in the email using a bit of MIME trickery, although this is far more complicated, using the following steps:


1. Generate the chart and give it a name so it is stored in a variable.
2. Generate a UUID that you will use as a CID for the image in the email.
3. Save the image to a temporary directory using the UUID as the filename.
4. Write the HTML contents of the email and place an <img src=" the UUID"> where you want the chart to appear.
5. Attach the file to the email
6. Delete the temp file

Something like:

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation