send()


Description

Sends an e-mail.

Before calling this function, you need to set required parameters such as e-mail addresses of receiver and sender.

Syntax

email.send()

Parameters

none

Returns

1 - on success
0 - on failure

Example

#include <SPI.h>
#include <Phpoc.h>

PhpocEmail email;

void setup() {
  Serial.begin(9600);
  while(!Serial)
    ;

  Phpoc.begin(PF_LOG_SPI | PF_LOG_NET | PF_LOG_APP);
  //Phpoc.begin();

  Serial.println("Email Client Test");

  // 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("H");
  email.write("ello\r\n", 6);
  email.endMessage();

  // send email
  if(email.send() > 0)
    Serial.println("Email send ok");
  else
    Serial.println("Email send failed");
}

void loop() {
}