mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
smtp: add base64 encoding to the body of the emails and use utf8, to prevent format confusion (#15589)
This commit is contained in:
parent
72056f36d8
commit
f285ebd91c
@ -245,12 +245,13 @@ fn (mut c Client) send_body(cfg Mail) ? {
|
||||
}
|
||||
|
||||
if is_html {
|
||||
sb.write_string('Content-Type: text/html; charset=UTF-8')
|
||||
sb.write_string('Content-Type: text/html; charset=UTF-8\r\n')
|
||||
} else {
|
||||
sb.write_string('Content-Type: text/plain; charset=UTF-8')
|
||||
sb.write_string('Content-Type: text/plain; charset=UTF-8\r\n')
|
||||
}
|
||||
sb.write_string('Content-Transfer-Encoding: base64')
|
||||
sb.write_string('\r\n\r\n')
|
||||
sb.write_string(cfg.body)
|
||||
sb.write_string(base64.encode_str(cfg.body))
|
||||
sb.write_string('\r\n.\r\n')
|
||||
c.send_str(sb.str())?
|
||||
c.expect_reply(.action_ok)?
|
||||
|
@ -131,3 +131,11 @@ fn test_smtp_multiple_recipients() ? {
|
||||
|
||||
assert true
|
||||
}
|
||||
|
||||
fn test_smtp_body_base64encode() ? {
|
||||
$if !network ? {
|
||||
return
|
||||
}
|
||||
|
||||
assert true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user