Page 1 of 1

creating html email with new html templates email sending fe

Posted: Mon May 04, 2009 6:42 pm
by wfpost
I tested the new HTML template email sending feature and what I´m getting in my inbox is an email in plain text form. :dry:

Was these feature intended to do something else, or what do I need to do to create a HTML email instead of one with plain text and the html code only included in the mail body?

Anybody knows?

thanks ...

Re:creating html email with new html templates email sending

Posted: Mon May 04, 2009 8:18 pm
by admin
The feature takes a html template, fills it with values and sends this as an email body. So it is not really sending html emails. I have to admit, that I don't really know how a html-email might look like. Is it just a body with html tags in it or does it need additional info outside the body?

However, it is meant to send the selected ".html" file as is (but filled with data).

Re:creating html email with new html templates email sending

Posted: Mon May 04, 2009 8:46 pm
by wfpost
in order to send a HTML email, the email client needs to know how to process such an email:
http://en.wikipedia.org/wiki/HTML_e-mail

What´s meteohub email program?
sendmail?

dann müsste es so klappen
http://www.perlunity.de/perl/forum/thread_013318.shtml


Community » CGI: Allgemeines Forum zur Themenübersicht Themensuche Themenansicht in Thread-Modus


Beitrag
Kann sendmail auch HTML Mails verschicken
Seitenanfang
Hallo,

ich öffne mit meinem Script eine html Datei und verschickte diese mit sendmail. Leider kommt nur der Code als reiner Code an, und nicht im HTML Format.
Geht das auch anders ?

Gruß Christof

Datum: 18.04.2002-23:47

Beitragre: Kann sendmail auch HTML Mails verschicken
Seitenanfang
Das hat mit sendmail nichts zu tun. Sendmail verschickt nur den Text, denn Du angibst. Damit das als HTML-Mail im Mailprogramm erscheint, musst Du einen entsprechenden Header mitschicken. Das geht sehr einfach mit dem Modul Mime::Lite

use MIME::Lite;
$msg = new MIME::Lite

From => "from\\@server.de",
To => "to\\@server.de",
Subject => "Das ist eine HTML-Mail",
Type => 'text/html',
Data => "<HTML><BODY><H1>HTML MAIL</H1></BODY></HTML>";

$msg->send;

Schau einfach mal in die Modul-Doku, dass ist das noch genau erklärt.

Datum: 19.04.2002-17:25

Beitragre: Kann sendmail auch HTML Mails verschicken
Seitenanfang
oder du schreibst einfach als erste Zeile im MailBody
print MAIL "Content-Type: text/html\\n\\n";

Datum: 19.04.2002-21:53

Beitragre: Kann sendmail auch HTML Mails verschicken
Seitenanfang
Wenn Du HTML-Mails verschicken möchtest, dann beschäftige Dich vorher mit den MIME Formaten. Ich hab da so meine Erfahrungen gemacht.
Am einfachsten schust Du Dir verschiedene Quelltexte von E-Mails an.
Reine HTML-Mails zum Beispiel können nicht alle User lesen, daher sollte zumindest per multipart/alternative der Text im Format plain/text mit gesandt werden.

Datum: 19.04.2002-23:55

Beitragre: Kann sendmail auch HTML Mails verschicken
Seitenanfang
Ich hab bei meinem Space-Anbieter auch ewig rumtesten müssen: Letztendlich hat folgendes geklappt:

print MAIL "From: xyz\\@xyz.com\\n";
print MAIL "To: xyz\\@xyz.net\\n";
print MAIL "Subject: Dies ist ein Test\\n";
print MAIL "Content-Type: text/html; charset=utf-8\\n";
print MAIL "\\n\\n";
print MAIL2 "TestTestTest\\n\\n";

...oder einen anderen charset eintragen
Nur Content-Type: text/html einzutragen hat bei meinem Server nix geholfen, da der Mail-Server sein "plain/text" einfach drübergeknallt hat

Datum: 24.04.2002-09:04

Re:creating html email with new html templates email sending

Posted: Mon May 04, 2009 10:31 pm
by skyewright
admin wrote:However, it is meant to send the selected ".html" file as is (but filled with data).
FWIW, a plain text email constructed that way is exactly what I expected, and am happy with.

I appreciate that some might want html e-mail, but I hope that if implemented it would be optional, with plain text only still possible.

Re:creating html email with new html templates email sending

Posted: Tue May 05, 2009 5:37 pm
by Nimbus43
Hello Boris,

Thanks very much for implementing the e-mail feature. Do you think you can make it possible to send just the weather data without all the html stuff?

Example:

Weather report 200905051600:
Temp: 21,5
Baro: 1031
Wind: 21 km/h (or kts) NNE
Gusts: 34 km/h
Rain: 4,5 mm


Kind regards,

Mario

Re:creating html email with new html templates email sending

Posted: Tue May 05, 2009 5:53 pm
by admin
it sends exactly the data that is in the template file. If you don't put html tags in it, Meteohub will not invent them ;-)

Your Example can be handled by a template file named "minbusexample.html" with this plain text in it:

Code: Select all

Weather report [actual_localdate]
Temp: [actual_th0_temp_c:-]
Baro: [actual_thb0_sealevel_hpa:-]
Wind: [actual_wind0_speed_kmh:-] km/h [actual_wind0_dir_en:-]
Gust: [actual_wind0_gustspeed_kmh:-] km/h
Rain: [day1_rain0_total_mm:-] mm
The ":-" in the variable name takes care that "-" is displayed if the value is not available. Otherwise Meteohub will display the variable name, which looks ugly to my eyes.

Re:creating html email with new html templates email sending

Posted: Tue May 05, 2009 6:04 pm
by Nimbus43
Boris,

OK, great, thank you very much!

Regards,

Mario

Re:creating html email with new html templates email sending

Posted: Thu May 07, 2009 7:36 pm
by admin
btw, someone asked for the mail send program used in meteohub. It is eSMTP, some basic info can be found here: http://blogs.techrepublic.com.com/opensource/?p=232

Re:creating html email with new html templates email sending

Posted: Thu May 07, 2009 8:26 pm
by cbhiii
Is it possible for the email program in Meteohub to include the following lines in the header when email is sent so that email programs will recognize the HTML and display it properly?


[*]MIME-Version: 1.0
Content-Type: text/html;
charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable

Re:creating html email with new html templates email sending

Posted: Sun Jun 07, 2009 9:53 am
by wfpost
admin wrote:btw, someone asked for the mail send program used in meteohub. It is eSMTP, some basic info can be found here: http://blogs.techrepublic.com.com/opensource/?p=232
the docs of eSMTP doesn´t give any hint that html-email is supported.
Also, I was wondering the config file isn´t filled with any user settings.
Looks like a temporary file is used at the very moment email is sent and the config file is returned to its default values.

No html-email possible, even with manual altering of config files? True?