Italian [risolto] [b4a] invio email con mail() php

ivanomonti

Expert
Licensed User
Longtime User
Ciao ragazzi ho bisogno di un vero aiuto, vi chiedo perfavore a chi sa gestire questo problema come posso risolverlo.

ERRORE DAL SERVER


'530 5.7.0 https://support.google.com/mail/?p=WantAuthError lw26-20020a170906bcda00b009310d4dece9sm1215609ejb.62 - gsmtp
'(RuntimeException) java.lang.RuntimeException: Empty writer returned: 530-5.7.0 Authentication Required. Learn more at



B4X:
        Log("started")
        Dim smtp As SMTP
        smtp.Initialize(smtpServer, smtpPort,smtpUserEmail, smtpUserPassword, "smtp")
        smtp.StartTLSMode = True
        smtp.UseSSL = True
        smtp.Subject = "MIASmart Social AI"
        smtp.Body = "CODE: " & code
        smtp.To.Add(receipientEmail)
        smtp.Send
        Wait For smtp_MessageSent(Success As Boolean)
        Log(Success)
        Log(LastException)
 

ivanomonti

Expert
Licensed User
Longtime User
@LucaMs grazie ci provo, poi ti aggiorno e l'errore del server l'ho scritto...


'530 5.7.0 https://support.google.com/mail/?p=WantAuthError lw26-20020a170906bcda00b009310d4dece9sm1215609ejb.62 - gsmtp
'(RuntimeException) java.lang.RuntimeException: Empty writer returned: 530-5.7.0 Authentication Required. Learn more at
 

ivanomonti

Expert
Licensed User
Longtime User

530, "5.7.0", Must issue a STARTTLS command first (È necessario eseguire prima di tutto il comando STARTTLS).

STARTTLS? qui mi ippappino :-(
 

ivanomonti

Expert
Licensed User
Longtime User
Intendevo: scrivilo su Google Search!
fatto e riprovato tutti gli esempi qui nel forum ma non ne esco, credimi forse sono proprio negato con autorizzazioni e cavoli vari
 

ivanomonti

Expert
Licensed User
Longtime User
@LucaMs perdonami, ma usare mail() php come si procede, nel senso come invio alla pagina i 3 parametri

1) Email ricevente
2) Subject
3) message


Mail() php:
<?php
// The message
$message = "Line 1\r\nLine 2\r\nLine 3";

// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70, "\r\n");

// Send
mail('caffeinated@example.com', 'My Subject', $message);
?>
 

ivanomonti

Expert
Licensed User
Longtime User
Allora sono arrivato a questa soluzione

1) nel mio server mail ho scritto un mail() php
2) nella applicazione richiamo mail.php e passo i tre parametri

tutto il resto viene da se, certo che il mail php ora e scarno e quindi senza controlli (cerco poi un php decente), alla fine inviare il parametro è abbastanza semplice

...?1=destinatario@gmail.com&2=codiceattivazione&3=12456

codice php:
<?php
    $destinatario=$_GET['1'];
    $oggetto=$_GET['2'];
    $messaggio=$_GET['3'];
    $headers='MIME-Version: 1.0'. '\r\n' .'Content-type: text/html; charset=iso-8859-1'. '\r\n' .'To: Mary <info@miasmart.it>'. '\r\n' .'X-Mailer: PHP/'.phpversion();
    mail($destinatario, $oggetto, $messaggio, $headers)
?>

Metto qui magari diventa utile a qualcuno
 

sirjo66

Well-Known Member
Licensed User
Longtime User
per poter inviare email con google, devi attivare l'autorizzazione a due fattori e poi generare una password, lo hai fatto ???
 

ivanomonti

Expert
Licensed User
Longtime User
per poter inviare email con google, devi attivare l'autorizzazione a due fattori e poi generare una password, lo hai fatto ???
si l'ho fatto ma nulla di buono alla fine uso mail() di php e vado tranquillo è user che deve ricevere e io devo solo spedire, google accetta la mia email in ingresso quindi dovrei essere coperto al 99%
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…