Writes data to e-mail body.
This data can be written as a byte or series of bytes.
email.write(val)
email.write(buf, len)
val - a value to write as a single byte
buf - an array to write as series of byes
len - the length of the buffer
Returns an int represents the number of bytes written.
#include <Phpoc.h>
PhpocEmail email;
void setup() {
Serial.begin(9600);
while(!Serial)
;
// initialize PHPoC [WiFi] Shield:
Phpoc.begin(PF_LOG_SPI | PF_LOG_NET | PF_LOG_APP);
//Phpoc.begin();
Serial.println("Sending email to server directly");
// setup From/To/Subject:
email.setFrom("from_email_address", "from_user_name");
email.setTo("to_email_address", "to_user_name");
email.setSubject("Mail from PHPoC Shield for Arduino");
// write email message:
email.beginMessage();
email.write("Hello, world!\r\n");
email.write("I am PHPoC Shield for Arduino\r\n");
email.write("Good bye\r\n");
email.endMessage();
// send email:
if(email.send() > 0)
Serial.println("Email send ok");
else
Serial.println("Email send failed");
}
void loop() {
}