Geschafft!
Hier die Lösung:
1) Beim Zertifikat muss "bluewin.ch" angegeben werden
2) UserID und Passwort müssen Base64 encoded angegeben werden (Encoden über diese Webseite möglich: https://www.base64encode.org/) Oben Klartext rein, PB ENCODE drücken, unten kommt das Ergebnis raus.
3) in der Funktion readResponse muss unbedingt ein Delay von 1000 (=1 Sec) angegeben werden, damit der Mailserver nachkommt.
Hier das Ergebnis und die Lösung:
Die Rückmeldungen des Mailservers
------------------------------------------------
18:06:54.774 -> Connected to server
18:06:55.805 -> 220 smtpauths.bluewin.ch vimdzmsp-sfwd06.bluewin.ch Swisscom AG ESMTP server ready
18:06:55.899 -> Sending EHLO
18:06:56.836 -> 250-smtpauths.bluewin.ch hello [84.72.nnn.nnn], pleased to meet you
18:06:56.883 -> 250-AUTH LOGIN PLAIN
18:06:56.930 -> 250-SIZE 26214400
18:06:56.930 -> 250-ENHANCEDSTATUSCODES
18:06:56.970 -> 250-PIPELINING
18:06:56.970 -> 250-8BITMIME
18:06:57.004 -> 250 OK
18:06:57.004 -> AUTH LOGIN
18:06:57.972 -> 334 VXNlcm5hbWU6
18:06:58.958 -> 334 UGFzc3dvcmQ6
18:06:59.005 -> Sending From
18:06:59.976 -> 235 2.7.0... authentication succeeded
18:07:00.023 -> 250 2.1.0 xyz@abc.ch sender ok
18:07:00.070 -> Sending To
18:07:01.008 -> 250 2.1.5 xyz@abc.ch recipient ok
18:07:01.055 -> Sending DATA
18:07:02.039 -> 354 OK
18:07:02.039 -> Sending email
18:07:08.073 -> 250 2.0.0 U9C3ouAp5flOAUQC7ogsWS mail accepted for delivery
18:07:08.120 -> Request sent
Der Programmcode
--------------------------
void eMailSendNow()
{
// connection to the mailserver
if (client.connectSSL("smtpauths.bluewin.ch", 465 )) {
Serial.println("Connected to server");
readResponse();
// Say hello with the own IP address
client.println("EHLO 192.168.n.nnn"); // my IP address
readResponse();
client.println("AUTH LOGIN");
readResponse();
client.println("SHVnbw=="); // User ID Base64 encoded
readResponse();
client.println("cnVtcGVsc3RpbHpjaGVuMw=="); // password Base64 encoded
// email address (sender)
client.println("MAIL From: xyz@abc.ch");
readResponse();
// change to recipient address
client.println("RCPT To: xyz@abc.ch");
readResponse();
client.println("DATA");
readResponse();
// own email address
client.println("From: xyz@abc.ch");
readResponse();
// recipient address
client.println("To: xyz@abc.ch");
readResponse();
client.println("Subject: My Test!"); // mail title
readResponse();
client.println("\
"); // without empty line, don't appear the text!!
readResponse();
client.println("Test"); // mail text
readResponse();
client.println("."); // the dot signalize the end of mail
readResponse();
}
readResponse();
// if the server's disconnected, stop the client:
if (!client.connected()) {
client.stop();
// do nothing forevermore:
//while (true);
}
}
void readResponse()
{
delay( 1000 ); // important to not get an error from mailserver
// if there are incoming bytes available
// from the server, read them and print them:
while (client.available()) {
char c = client.read();
Serial.write(c); // put the returncode and message to console
}
}