vibe.d

seany seany at uni-bonn.de
Sat Mar 11 10:12:53 UTC 2023


Hi

I am trying to send an email via vibe .d

Here is the code snippet.

```
Mail email = new Mail;

	email.headers["Date"] = 
Clock.currTime(PosixTimeZone.getTimeZone("America/New_York")).toRFC822DateTimeString(); // uses UFCS
	email.headers["Sender"] = "<<myapp_de.sean at gmail.com>"; // valid 
mail
	email.headers["From"] = "<myapp_de.sean at gmail.com>"; // valid 
email
	email.headers["To"] = "<seany at domain.de>";  // valid mail.
	email.headers["Subject"] = "Betreff";
	email.headers["Content-Type"] = "text/plain;charset=utf-8";
	email.bodyText = "Textinfo";

	setLogLevel(LogLevel.verbose4);															writeln("00");



	auto settings = new SMTPClientSettings("smtp.gmail.com", 587);
	settings.connectionType = SMTPConnectionType.startTLS;
	settings.authType = SMTPAuthType.login;
	settings.username = "myapp_de.sean at gmail.com";
	settings.password = "mypass_veryStronk";

	logInfo("Sending mail...");
     sendMail(settings, email);
     logInfo("done.");

	res.writeBody("An email has been sent to the user ");
```









I get this error :


```
[main(toaW) INF] Sending mail...
Thread exit Eventcore DNS Lookup (index 9) (main=false)
Socket 43, read 86 bytes: ok
Socket 43, read 192 bytes: ok
EHLO response: 250-smtp.gmail.com at your service, 
[2a02:3030:9:4f1a:bd94:4bec:9e39:c9fa]
EHLO response: 250-SIZE 35882577
EHLO response: 250-8BITMIME
EHLO response: 250-STARTTLS
EHLO response: 250-ENHANCEDSTATUSCODES
EHLO response: 250-PIPELINING
EHLO response: 250-CHUNKING
EHLO response: 250 SMTPUTF8
Socket 43, read 30 bytes: ok
Socket 43, read 2416 bytes: ok
Socket 43, read 1208 bytes: ok
Socket 43, read 572 bytes: ok
validate callback for /C=US/O=Google Trust Services LLC/CN=GTS 
Root R1
SSL cert initial error: unable to get local issuer certificate
SSL cert not trusted or unknown issuer: /C=BE/O=GlobalSign 
nv-sa/OU=Root CA/CN=GlobalSign Root CA
SSL validation result: 0 (20)
OpenSSL error at ssl/statem/statem_clnt.c:1889: 
error:0A000086:SSL routines::certificate verify failed (-)
---------------------
HTTP server response:
---------------------
HTTP/1.1 500 Internal Server Error
Server: vibe.d/1.22.6
Date: Sat, 11 Mar 2023 10:09:49 GMT
Keep-Alive: timeout=10
Content-Type: text/plain; charset=UTF-8
Content-Length: 6133
---------------------
Exception while handling request POST /createNewOwner: 
object.Exception@/home/monsoon/.dub/packages/vibe-d-0.9.6-alpha.1/vibe-d/tls/vibe/stream/openssl.d(668): Connecting TLS tunnel: error:0A000086:SSL routines::certificate verify failed (167772294)
```


Note that dub is running on localhost.

How can I resolve this? Please help. Thank you


More information about the Digitalmars-d-learn mailing list