:- use_module(library(smtp)).
a :-
smtp_send_mail(
'[email protected]',
send_message,
[ security(ssl),
port(465),
host('smtp.gmail.com'),
auth('[email protected]'-'ifdv wtok hcwl risz'),
from('[email protected]')
]
).
send_message(Out) :-
format(Out, 'Hi Alice,\n\n', [ ]),
format(Out, 'Want to go out tonight?\n\n', [ ]),
format(Out, '\tCheers, Bob\n', [ ]).
library(smtp) works and i tested connection on SMTP Test Tool, it works too. But when i start script, i get Errors:
βERROR: Socket error: Connection refused
ERROR: In:
ERROR: [19] socket:tcp_connect((0000015238ae0a40),localhost:465)
ERROR: [18] setup_call_catcher_cleanup(smtp:tcp_socket((0000015238ae0a40)),smtp:tcp_connect((0000015238ae0a40),β¦),_7610,smtp:error_cleanup(_7644,β¦)) at c:/program files/swipl/boot/init.pl:679
ERROR: [16] smtp:smtp_open(localhost:465,_7678,_7680,[auth(β¦),β¦|β¦]) at c:/users/cxmv/appdata/local/swi-prolog/pack/smtp/prolog/smtp.pl:201
ERROR: [15]
ERROR: [14] sig_atomic(smtp:smtp_open(β¦,_7764,_7766,β¦))
ERROR: [13] setup_call_catcher_cleanup(smtp:smtp_open(β¦,_7810,_7812,β¦),smtp:do_send_mail(_7824,_7826,β[email protected]β,β¦,β¦),_7796,smtp:smtp_close(_7842,_7844)) at c:/program files/swipl/boot/init.pl:678
ERROR: [9] toplevel_call(user:user:a) at c:/program files/swipl/boot/toplevel.pl:1173
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.β