www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - curl: can't send email?

reply Andrew <hrdcoding gmail.com> writes:
What wrong?

```
import std.net.curl;

void main() {
     auto smtp = SMTP("smtps://smtp.gmail.com:465");
     smtp.setAuthentication("qwerty gmail.com", "password");
     smtp.mailTo = ["<ytrewq gmail.com"];
     smtp.mailFrom = "<qwerty gmail.com>";
     smtp.message = "Example Message";
     //smtp.proxy("127.0.0.1:9050");
     smtp.perform();
}
```

std.net.curl.CurlException std/net/curl.d(4364): Failed sending 
data to the peer on handle 55FACCB58AC0
----------------
??:? pure  safe void 
std.exception.bailOut!(std.net.curl.CurlException).bailOut(immutable(char)[],
ulong, scope const(char)[]) [0x55facbd8db5e]
??:? pure  safe bool 
std.exception.enforce!(std.net.curl.CurlException).enforce!(bool).enforce(bool,
lazy const(char)[], immutable(char)[], ulong) [0x55facbd8dad1]
??:? void std.net.curl.Curl._check(int) [0x55facbd7209b]
??:? int 
std.net.curl.Curl.perform(std.typecons.Flag!("throwOnError").Flag)
[0x55facbd724c7]
??:? int 
std.net.curl.SMTP.perform(std.typecons.Flag!("throwOnError").Flag)
[0x55facbd71a80]
??:? _Dmain [0x55facbd69b6b]
Jun 10 2019
next sibling parent Andre Pany <andre s-e-a-p.de> writes:
On Monday, 10 June 2019 at 16:10:07 UTC, Andrew wrote:
 What wrong?

 ```
 import std.net.curl;

 [...]
Curl smtp is a low level api. You need to know SMTP RFC. Please have a look here, this is a high level API on top of curl smtp: https://github.com/adamdruppe/arsd/blob/master/email.d Kind regards Andre
Jun 10 2019
prev sibling parent Adam D. Ruppe <destructionator gmail.com> writes:
On Monday, 10 June 2019 at 16:10:07 UTC, Andrew wrote:
     smtp.mailTo = ["<ytrewq gmail.com"];
There's a missing > in that string. idk if that is making a difference though, the error messages in this are awful.
Jun 10 2019