local smtp_from = task:get_from('smtp')
if u and smtp_from then
- local hdr
-
- if #smtp_from[1]['addr'] > 0 then
- if settings['add_smtp_user'] then
- hdr = string.format('auth=pass smtp.auth=%s smtp.mailfrom=%s',
- u, smtp_from[1]['addr'])
- else
- hdr = string.format('auth=pass smtp.mailfrom=%s',
- smtp_from[1]['addr'])
- end
- else
- if settings['add_smtp_user'] then
- hdr = string.format('auth=pass smtp.auth=%s', u)
- else
- hdr = 'auth=pass'
- end
+ local hdr = {[1] = 'auth=pass'}
+
+ if settings['add_smtp_user'] then
+ table.insert(hdr,'smtp.auth=' .. u)
+ end
+ if smtp_from[1]['addr'] then
+ table.insert(hdr,'smtp.mailfrom=' .. smtp_from[1]['addr'])
end
- table.insert(hdr_parts, hdr)
+ table.insert(hdr_parts, table.concat(hdr,' ')
end
if #hdr_parts > 0 then