コード例 #1
0
ファイル: snmp_app.c プロジェクト: wjw890912/PID_V0.0
void my_smtp_test(char *str)
{

	   smtp_Tcp_count[8]++;
    smtp_set_server_addr("220.181.12.18"/*"192.168.0.163"*/);
  //  -> set both username and password as NULL if no auth needed
    smtp_set_auth("*****@*****.**","wjw86831414718");

    smtp_send_mail("*****@*****.**", "*****@*****.**", "I am from MCU pass the SMTP", (const char *) str/*"DS18B20"*/, my_smtp_result_fn,
                   0);
	
}
コード例 #2
0
/** Same as smpt_send_mail but takes a struct smtp_send_request as single
 * parameter which contains all the other parameters.
 * To be used with tcpip_callback to send mail from interrupt context or from
 * another thread.
 *
 * WARNING: server and authentication must stay untouched until this function has run!
 *
 * Usage example:
 * - allocate a struct smtp_send_request (in a way that is allowed in interrupt context)
 * - fill the members of the struct as if calling smtp_send_mail
 * - specify a callback_function
 * - set callback_arg to the structure itself
 * - call this function
 * - wait for the callback function to be called
 * - in the callback function, deallocate the structure (passed as arg)
 */
void
smtp_send_mail_int(void *arg)
{
  struct smtp_send_request *req = arg;
  err_t err;

  LWIP_ASSERT("smtp_send_mail_int: no argument given", arg != NULL);

  if (req->static_data) {
    err = smtp_send_mail_static(req->from, req->to, req->subject, req->body,
      req->callback_fn, req->callback_arg);
  } else {
    err = smtp_send_mail(req->from, req->to, req->subject, req->body,
      req->callback_fn, req->callback_arg);
  }
  if ((err != ERR_OK) && (req->callback_fn != NULL)) {
    req->callback_fn(req->callback_arg, SMTP_RESULT_ERR_UNKNOWN, 0, err);
  }
}