Buona sera a tutti, coma da titolo il mio problema è chiaro, devo inviare un è mail dal sito situato sulla scheda SD della ethernet shield. Su google ho trovato svariati metodi, con javascript con ilm etodo location.header ecc... ma non sono ciò che voglio perche l' e-mail deve essere inviata automaticamente dalla pagina web poi ho letto alcuni post ma mi sono confuso ancora di più le idee, parlavano di smtp pop3 ecc... ma non vedo come poter interfacciare questi protocolli o meglio servizi alla pagina web.
spero in una vostra mano, grazie in anticipo a tutti. Michele.
Nessuno mi sa aiutare? Posto il codice javascript(il codice qui sotto ha già implementato l'invio email ma non è cio che voglio io poiche usa il link, e quindi l'istruzione location.href)
grazie in anticipo a tutti

<script>
strRELE = "";
var StatoRELE = 0;
var recipient = 'casadelia754@gmail.com',subject = 'Pompa!!';
function GetArduinoIO()
{
nocache = "&nocache=" + Math.random() * 1000000;
var request = new XMLHttpRequest();
request.onreadystatechange = function()
{
if (this.readyState == 4)
{
if (this.status == 200)
{
if (this.responseXML != null)
{
var vett=[];
var stringa = "";
var HA=$("#amount1").val();
var MA=$("#amount2").val();
var SA=$("#amount6").val();
var HS=$("#amount3").val();
var MS=$("#amount4").val();
var SS=$("#amount7").val();
var ASS=parseInt($("#amount5").val());
this.responseXML.getElementsByTagName('a1')[0].childNodes[0].nodeValue;
vett[0]=document.getElementsByClassName("a1")[0].innerHTML =this.responseXML.getElementsByTagName('a1')[0].childNodes[0].nodeValue;
this.responseXML.getElementsByTagName('ore')[0].childNodes[0].nodeValue;
vett[1]=document.getElementsByClassName("ore")[0].innerHTML =this.responseXML.getElementsByTagName('ore')[0].childNodes[0].nodeValue;
this.responseXML.getElementsByTagName('min')[0].childNodes[0].nodeValue;
vett[2]=document.getElementsByClassName("min")[0].innerHTML =this.responseXML.getElementsByTagName('min')[0].childNodes[0].nodeValue;
this.responseXML.getElementsByTagName('sec')[0].childNodes[0].nodeValue;
vett[3]=document.getElementsByClassName("sec")[0].innerHTML =this.responseXML.getElementsByTagName('sec')[0].childNodes[0].nodeValue;
localStorage.setItem("da_salvare", vett[0] + ";" + vett[1] + ";" + vett[2]+ ";" + vett[3]);
mostra();
/*this.responseXML.getElementsByTagName('pr')[0].childNodes[0].nodeValue;
document.getElementsByClassName("pr")[0].innerHTML =this.responseXML.getElementsByTagName('pr')[0].childNodes[0].nodeValue;
this.responseXML.getElementsByTagName('a2')[0].childNodes[0].nodeValue;
document.getElementsByClassName("a2")[0].innerHTML =this.responseXML.getElementsByTagName('a2')[0].childNodes[0].nodeValue;
this.responseXML.getElementsByTagName('a3')[0].childNodes[0].nodeValue;
document.getElementsByClassName("a3")[0].innerHTML =this.responseXML.getElementsByTagName('a3')[0].childNodes[0].nodeValue;*/
if (this.responseXML.getElementsByTagName('PIN')[0].childNodes[0].nodeValue === "on")
{
StatoRELE = 1;
document.getElementById("RELE").innerHTML = "ON";
document.getElementById("RELE").style.backgroundColor="red";
}
else
{
StatoRELE = 0;
document.getElementById("RELE").innerHTML = "OFF";
document.getElementById("RELE").style.backgroundColor="green";
}
if(HA!=HS && MA!=MS)
{
if( this.responseXML.getElementsByTagName('PIN')[0].childNodes[0].nodeValue==="off" &&
this.responseXML.getElementsByTagName('ore')[0].childNodes[0].nodeValue===HA &&
this.responseXML.getElementsByTagName('min')[0].childNodes[0].nodeValue===MA &&
this.responseXML.getElementsByTagName('sec')[0].childNodes[0].nodeValue===SA )
{
document.getElementById("RELE").innerHTML = "ON";
StatoRELE = 1;
strRELE = "&RELE=1";
document.getElementById("RELE").style.backgroundColor="red";
var message='Pompa avviata dal timer.';
location.href = 'http://mail.google.com/mail/?view=cm&fs=1'+
'&to=' + recipient +
'&su=' + subject +
'&body=' + message +
'&ui=1';
}
else
if( this.responseXML.getElementsByTagName('PIN')[0].childNodes[0].nodeValue==="on" &&
this.responseXML.getElementsByTagName('ore')[0].childNodes[0].nodeValue===HS &&
this.responseXML.getElementsByTagName('min')[0].childNodes[0].nodeValue===MS &&
this.responseXML.getElementsByTagName('sec')[0].childNodes[0].nodeValue===SS)
{
document.getElementById("RELE").innerHTML ="OFF";
StatoRELE = 0;
strRELE = "&RELE=0";
document.getElementById("RELE").style.backgroundColor="green";
var message='Pompa spenta dal timer.';
location.href = 'http://mail.google.com/mail/?view=cm&fs=1'+
'&to=' + recipient +
'&su=' + subject +
'&body=' + message +
'&ui=1';
}
}
if( this.responseXML.getElementsByTagName('PIN')[0].childNodes[0].nodeValue==="on" &&
this.responseXML.getElementsByTagName('a1')[0].childNodes[0].nodeValue>ASS)
{
document.getElementById("RELE").innerHTML ="OFF";
StatoRELE = 0;
strRELE = "&RELE=0";
document.getElementById("RELE").style.backgroundColor="green";
var message='Pompa spenta per elavto assorbimento!!';
location.href = 'http://mail.google.com/mail/?view=cm&fs=1'+
'&to=' + recipient +
'&su=' + subject +
'&body=' + message +
'&ui=1';
}
}
}
}
}
request.open("GET", "ajax_inputs" + strRELE + nocache, true);
request.send(null);
setTimeout('GetArduinoIO()', 1000);
strRELE = "";
}
mostra= function()
{
var key="da_salvare";
var stringa = "";
var vett=[];
for (key in localStorage)
{
vett = localStorage.getItem("da_salvare").split(";");
stringa = stringa + vett[0] + ' ' + vett[1] + ' ' + vett[2] +' ' + vett[3] + "\n";
}
document.getElementById("alunni_da_mostrare").value =stringa+"\n";
};
function Ricevi_Valore_Bottone()
{
if (StatoRELE === 1)
{
StatoRELE = 0;
strRELE = "&RELE=0";
}
else
{
StatoRELE = 1;
strRELE = "&RELE=1";
}
}
</script>
Solo un server SMTP può inviare email. Dalla tua pagina accedi ad un server SMTP dando i dati della email e lui poi la spedirà. Come fa il tuo programma di email su PC.
http://playground.arduino.cc/Italiano/Mail
Il problema è che a volte i server SMTP non accettano facilmente di spedire email "di nascosto" senza un front-end:
http://forum.arduino.cc/index.php?topic=253595.0