# How to use the SMTPClient-package

**URL:** https://discourse.julialang.org/t/how-to-use-the-smtpclient-package/9317
**Category:** General Usage
**Created:** [February 25, 2018, 3:31pm UTC](https://discourse.julialang.org/t/how-to-use-the-smtpclient-package/9317 "2018-02-25T15:31:40Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![johann.spies](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johann.spies/32/8805_2.png) [@johann.spies](https://discourse.julialang.org/u/johann.spies)
#### Post date: [February 25, 2018, 3:31pm UTC](https://discourse.julialang.org/t/how-to-use-the-smtpclient-package/9317/1 "2018-02-25T15:31:40Z")

</div>

The only example of using the SMTPClient package I could find was on [https://rosettacode.org/wiki/Send\_email#Julia](https://rosettacode.org/wiki/Send_email#Julia).

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

```nohighlight
 
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")
end
 
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)
end
 
sendemail("to@example.com", "from@example.com", "TEST", "hello there test message text here", "smtp: localhost",
          user="from@example.com", password="example.com")

```

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

---

<div class="post-metadata">

### Author: ![John\_Hearns](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/john_hearns/32/1685_2.png) [@John\_Hearns](https://discourse.julialang.org/u/John_Hearns)
#### Post date: [February 26, 2018, 5:17pm UTC](https://discourse.julialang.org/t/how-to-use-the-smtpclient-package/9317/2 "2018-02-26T17:17:57Z")

</div>

Segfaults for me too

ulia\> resp = send(“smtp://localhost:25”,[“[john.hearns@asml.com](mailto:john.hearns@asml.com)”],“[john.hearns@asml.com](mailto:john.hearns@asml.com)”, body, opt)

signal (11): Segmentation fault  
while loading no file, in expression starting on line 0  
\_IO\_sgetn at /lib64/libc.so.6 (unknown line)  
fread at /lib64/libc.so.6 (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/libcurl.so.4 (unknown line)  
curl\_easy\_perform at /pscratch/jhearns/julia-903644385b/bin/…/lib/julia/libcurl.so.4 (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
