Exemple #1
0
void main()
{
	sock_init();
	// Wait for the interface to come up
	while (ifpending(IF_DEFAULT) == IF_COMING_UP) {
		tcp_tick(NULL);
	}

   #if _USER
   	smtp_setserver(SMTP_SERVER);
   #endif

#ifdef USE_SMTP_AUTH
	smtp_setauth ("myusername", "mypassword");
#endif

	smtp_sendmail(TO, FROM, SUBJECT, BODY);

	while(smtp_mailtick()==SMTP_PENDING)
		continue;

	if(smtp_status()==SMTP_SUCCESS)
		printf("Message sent\n");
	else
		printf("Error sending message\n");
}
Exemple #2
0
int main()
{
	int line_num;	// This is our data handler opaque parameter.

	sock_init();
	// Wait for the interface to come up
	while (ifpending(IF_DEFAULT) == IF_COMING_UP) {
		tcp_tick(NULL);
	}

   #if _USER
   	smtp_setserver(SMTP_SERVER);
   #endif

#ifdef USE_SMTP_AUTH
	smtp_setauth ("myusername", "mypassword");
#endif

	smtp_sendmail(TO, FROM, SUBJECT, NULL);	// No fixed message
	smtp_data_handler(mail_generator, &line_num, 0);	// Set message generator function

	line_num = 1;	// Initialize for data handler benefit.

	while(smtp_mailtick()==SMTP_PENDING)
		continue;

	if(smtp_status()==SMTP_SUCCESS)
		printf("Message sent\n");
	else
		printf("Error sending message\n");
	return 0;
}
Exemple #3
0
/**
 * Sends an email alert
 */
int sendEmail(int email) {
	// Full email address
   char fullEmail[50];

   // Check for error, should not happen any more
   if (email < 0) {
   	printf("Now you done f****d up son.");
   	return -1;
   }

   //Copy the phone numner
   strcpy(fullEmail, phoneNumber);

   // Send the email
	smtp_sendmail(
		strcat(fullEmail, carrierDomains[carrierChoice]), FROM,
		SUBJECT, emailBody[email]);

	// Wait until the message has been sent
	while (smtp_mailtick() == SMTP_PENDING) {
		continue;
	}

	// Check to see if the message was sent successfully
	if (smtp_status() == SMTP_SUCCESS) {
		printf("\n\rMessage sent\n\r");
	}
	else {
		printf("\n\rError sending the email message\n\r");
	}

	// Return
	return 0;
}
Exemple #4
0
void SendMail(int email)
{
	// Start sending the email
	smtp_sendmail(emailArray[email].to, 	  emailArray[email].from,
   	           emailArray[email].subject, emailArray[email].body);

	// Wait until the message has been sent
	while(smtp_mailtick()==SMTP_PENDING)
		continue;

	// Check to see if the message was sent successfully
	if(smtp_status()==SMTP_SUCCESS)
	{
		printf("\n\rMessage sent\n\r");
	}
	else
	{
		printf("\n\rError sending the email message\n\r");
	}
}