diff --git a/fhem/CHANGED b/fhem/CHANGED index d60b8e2a9..740058492 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,7 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - feature: 76_MSGMail: Add attribute mailtype as suggested by Roger + (forum #37206) - feature: 30_pilight_temp: reading battery state, attribut corrTemp to correct temperature - change: 73_km200: Wrong SwitchProgram time format fixed - feature: 73_km200: SwitchPrograms can be written/changed diff --git a/fhem/FHEM/76_MSGMail.pm b/fhem/FHEM/76_MSGMail.pm index 926ae2cba..57aed5e29 100644 --- a/fhem/FHEM/76_MSGMail.pm +++ b/fhem/FHEM/76_MSGMail.pm @@ -4,6 +4,7 @@ # # History: # +# 2015-05-15: Add attribute mailtype as suggested by Roger (forum #37206) # 2015-05-11: Improve error logging to assist problem solving # 2015-05-09: Assimilate mail related code from 75_MSG # 2015-05-06: Tidy up code for restructuring @@ -47,7 +48,7 @@ sub MSGMail_Initialize($) $hash->{SetFn} = "MSGMail_Set"; $hash->{DefFn} = "MSGMail_Define"; $hash->{UndefFn} = "MSGMail_Undef"; - $hash->{AttrList} = "loglevel:0,1,2,3,4,5,6 authfile smtphost smtpport subject from to cc CR:0,1"; + $hash->{AttrList} = "loglevel:0,1,2,3,4,5,6 authfile smtphost smtpport subject mailtype:plain,html from to cc CR:0,1"; my $name = "MSGMail"; @@ -97,6 +98,7 @@ sub MSGMail_Define($$) $attr{$name}{to} = $a[3]; $attr{$name}{smtphost} = $a[4]; $attr{$name}{authfile} = $a[5]; + $attr{$name}{mailtype} = "plain"; $attr{$name}{subject} = "FHEM "; $attr{$name}{CR} = "1"; @@ -203,6 +205,10 @@ sub MSGMail_Set($@) my $smtphost = AttrVal($name, "smtphost", ""); my $smtpport = AttrVal($name, "smtpport", "465"); # 465 is the default port my $cc = AttrVal($name, "cc", ""); # Carbon Copy + my $mtype = AttrVal($name, "mailtype", "plain"); + + my $mailtype = "text/plain"; + $mailtype= "text/$mtype" if ($mtype =~ m/^(plain|html)$/); return "No address specified, use attr $name from " if (!$from); @@ -235,7 +241,7 @@ sub MSGMail_Set($@) From => $from, To => $to, Subject => $subject, - Type => 'text/plain; charset=UTF-8', #'multipart/mixed', # was 'text/plain' + Type => "$mailtype; charset=UTF-8", #'multipart/mixed', # was 'text/plain' Data => $mess ); @@ -357,8 +363,8 @@ sub MSGMail_conn($) -
-
+ +
Examples: