How to use the SMTPClient-package


The only example of using the SMTPClient package I could find was on

I adapted it a bit to test but gets a segmentation fault on Version 0.6.2:

addbrackets(s) = replace(s, r"^\s*([^\<\>]+)\s*$", s"<\1>")
function wrapRFC5322(from, to, subject, msg)
    timestr = Libc.strftime("%a, %d %b %Y %H:%M:%S %z", time())
    IOBuffer("Date: $timestr\nTo: $to\nFrom: $from\nSubject: $subject\n\n$msg")
function sendemail(from, to, subject, messagebody, serverandport;
                   cc=[], user="", password="", isSSL=false, blocking=true)
    opt = SendOptions(blocking=blocking, isSSL=isSSL, username=user, passwd=password)
    send(serverandport, map(s -> addbrackets(s), vcat(to, cc)), addbrackets(from),
         wrapRFC5322(addbrackets(from), addbrackets(to), subject, messagebody), opt)
sendemail("", "", "TEST", "hello there test message text here", "smtp: localhost",
          user="", password="")

I want to use the localhost on port 25 without authentication to send out email. How do I do it?


Segfaults for me too

ulia> resp = send(“smtp://localhost:25”,[“”],“”, body, opt)

signal (11): Segmentation fault
while loading no file, in expression starting on line 0
_IO_sgetn at /lib64/ (unknown line)
fread at /lib64/ (unknown line)
unknown function (ip: 0x2aaac05d6812)
unknown function (ip: 0x2aaac05d6ec9)
unknown function (ip: 0x2aaac05e06db)
curl_multi_perform at /pscratch/jhearns/julia-903644385b/bin/…/lib/julia/ (unknown line)
curl_easy_perform at /pscratch/jhearns/julia-903644385b/bin/…/lib/julia/ (unknown line)
_do_send at /pscratch/jhearns/.julia/v0.6/SMTPClient/src/SMTPClient.jl:137
send at /pscratch/jhearns/.julia/v0.6/SMTPClient/src/SMTPClient.jl:233

Jiulia 0.6.0 Centos 6 libcurl libcurl-7.19.7-53