Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: GSwifi_httpd GSwifi_websocket GSwifi_tcpclient GSwifi_tcpserver ... more
Fork of GSwifi by
Revision 32:e19538c1f13d, committed 2013-02-26
- Comitter:
- gsfan
- Date:
- Tue Feb 26 07:39:58 2013 +0000
- Parent:
- 31:0abdc584823d
- Child:
- 33:b5a5a1e6325f
- Commit message:
- fix sendmail
Changed in this revision
| GSwifi_http.cpp | Show annotated file Show diff for this revision Revisions of this file |
| GSwifi_smtp.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/GSwifi_http.cpp Tue Feb 26 06:05:11 2013 +0000
+++ b/GSwifi_http.cpp Tue Feb 26 07:39:58 2013 +0000
@@ -189,6 +189,7 @@
char buf[200], data[100];
if (code == 0) {
+ // dummy read
timeout.start();
while (timeout.read_ms() < GS_TIMEOUT) {
wait_ms(10);
--- a/GSwifi_smtp.cpp Tue Feb 26 06:05:11 2013 +0000
+++ b/GSwifi_smtp.cpp Tue Feb 26 07:39:58 2013 +0000
@@ -51,6 +51,7 @@
send(cid, "EHLO gainspan\r\n", 15);
wait_ms(100);
if (wait_smtp(cid ,250)) goto exit;
+ wait_smtp(cid ,0);
if (user && pwd) {
// smtp auth
@@ -79,12 +80,22 @@
if (wait_smtp(cid ,354)) goto quit;
// mail data
+ send(cid, "From: ", 6);
+ send(cid, from, strlen(from));
+ send(cid, "\r\n", 2);
+ send(cid, "To: ", 9);
+ send(cid, to, strlen(to));
+ send(cid, "\r\n", 2);
+ send(cid, "Subject: ", 9);
+ send(cid, subject, strlen(subject));
+ send(cid, "\r\n\r\n", 4);
+
send(cid, mesg, strlen(mesg));
send(cid, "\r\n.\r\n", 5);
if (wait_smtp(cid ,250)) goto quit;
ret = 0;
- LOG("From: %s To: %s %d\r\n", from, to, strlen(mesg));
+ LOG("Mail, from: %s, to: %s %d\r\n", from, to, strlen(mesg));
quit:
send(cid, "QUIT\r\n", 6);
@@ -100,7 +111,22 @@
int i, n, len = 0;
char buf[200], data[100];
+ if (code == 0) {
+ // dummy read
+ timeout.start();
+ while (timeout.read_ms() < GS_TIMEOUT) {
+ wait_ms(10);
+ if (_gs_sock[cid].data->isEmpty()) break;
+ poll();
+ n = recv(cid, buf, sizeof(buf));
+ if (n <= 0) break;
+ }
+ timeout.stop();
+ return 0;
+ }
+
// wait responce
+ len = 0;
timeout.start();
while (timeout.read_ms() < SMTP_TIMEOUT) {
wait_ms(10);

GainSpan Wi-Fi GS1011