clutil 2010.141.0 → 2010.141.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/cl/util/smtp.rb +7 -3
- metadata +2 -2
data/cl/util/smtp.rb
CHANGED
@@ -91,6 +91,10 @@ module ClUtil
|
|
91
91
|
@smtp.enable_starttls
|
92
92
|
end
|
93
93
|
|
94
|
+
def content_type
|
95
|
+
@body =~ /<html>/ ? "text/html" : "text/plain"
|
96
|
+
end
|
97
|
+
|
94
98
|
def build_message
|
95
99
|
msg = format_headers
|
96
100
|
boundary = create_boundary
|
@@ -107,7 +111,7 @@ module ClUtil
|
|
107
111
|
if @body
|
108
112
|
msg << [ "--#{boundary}\n" ] if !@attachments.empty?
|
109
113
|
msg << [
|
110
|
-
"Content-Type:
|
114
|
+
"Content-Type: #{content_type}; charset=\"iso-8859-1\"\n",
|
111
115
|
"Content-Transfer-Encoding: 8bit\n",
|
112
116
|
"\n",
|
113
117
|
"#{@body}\n",
|
@@ -160,7 +164,7 @@ def sendmail(to, from, subj, body, smtpsrv=nil, attachments=nil, extra_headers=n
|
|
160
164
|
attachments = [attachments].flatten
|
161
165
|
attachments.compact!
|
162
166
|
attachments.each do |attachment_fn|
|
163
|
-
smtp.attachments << ClUtil::Attachment.load_from_file(attachment_fn)
|
164
|
-
end
|
167
|
+
smtp.attachments << ClUtil::Attachment.load_from_file(attachment_fn)
|
168
|
+
end
|
165
169
|
smtp.sendmail
|
166
170
|
end
|