1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

examples: fix unset reader notice for the smtp/mail example (#17998)

This commit is contained in:
Thomas Peißl 2023-05-02 21:54:57 +02:00 committed by GitHub
parent d3dbd7b743
commit 353de60158
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -31,6 +31,6 @@ fn main() {
body_type: .html
body: body
}
mut client := smtp.new_client(client_cfg) or { panic('Error configuring smtp') }
client.send(send_cfg) or { panic('Error resolving email address') }
mut client := smtp.new_client(client_cfg) or { panic('Error with configuring smtp: ${err}') }
client.send(send_cfg) or { panic('Error resolving email address: ${err}') }
}

View File

@ -33,7 +33,7 @@ pub struct Client {
mut:
conn net.TcpConn
ssl_conn &ssl.SSLConn = unsafe { nil }
reader io.BufferedReader
reader ?&io.BufferedReader
pub:
server string
port int = 25
@ -139,7 +139,7 @@ fn (mut c Client) connect_ssl() ! {
fn (mut c Client) expect_reply(expected ReplyCode) ! {
mut str := ''
for {
str = c.reader.read_line()!
str = c.reader or { return error('the Client.reader field is not set') }.read_line()!
if str.len < 4 {
return error('Invalid SMTP response: ${str}')
}