Go Down

Topic: Email Timing Issue (Read 4112 times) previous topic - next topic


I have a project that uses an Arduino & a WiShield to connect to my home network.
This then sends me an email via a PHP page at regular intervals like twice a day.
The email contains a timestamp. 
Sometimes I don't get the email until hours later, but it always has the right timestamp.
The PHP page is on a server on the Internet, not inside my home.
What would cause the email to be delayed for hours?
Is this a PHP or server issue?


Coding Badly

Well, there is the usual suspect.  Misbehaving internet service provider.

Are you closing the session to the email server cleanly?  I vagualy recall that sending email requires a "quit" when finished.


How are you sending it?

With php it should be as simple as
Code: [Select]
$to = "recipient@example.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";

if (mail($to, $subject, $body))
   echo("<p>Message successfully sent!</p>");
   echo("<p>Message delivery failed...</p>");

I am using this with success myself.

Are you sending more than just a few emails with this daily? Wondering if there could be some kind of limit on it, so it can't be used for spam.
captain-slow.dk | non contagious!

Coding Badly

I forgot about "mail".  Ignore my post.


I am using the following :
if ( mail($tot,$subject,$message,$headers,"From: $from\nContent-Type: text/html; charset=iso-8859-1") ) {

   echo "Yahoo!";
   } else {
   echo "The email has failed!";


Just be sure that you hide the url to that page... sending mail via php is very risky without input sanitation... You could have your script co-opted as a spambot....


not sure if this is connected, but i am kinda having the same problem.  i have a telnet server set up on the arduino and when a specific command is sent to it, it sends a get command to the php site which the php site then uses to compare against a mysql page which then sends out an email to a specific address...anyhow the problem i'm having is that i run the command, email goes out, run it again and email goes out, third time and on, connection to the php server fails and nothing goes out.  maybe this is your problem as well, maybe the connection is failing and then later going out again once the connection is re-established.  just a thought


Thanks for the suggestions.
I don't think the problem is establishing a connection as the timestamp is correct.
Probably a server issue which I can do nothing about.
What is the proper way to hide the URL?


What is the proper way to hide the URL?

Just make it hard to guess by humans or robots, and don't ever post a link to it on a page that gets crawled by a search engine.

example.com/faldjfsdljkdf/asdlfsdkjfdfjk.php should work...

Go Up