FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » FORMS, validating mail was sent
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: FORMS, validating mail was sent [message #181905 is a reply to message #181855] Fri, 21 June 2013 18:30 Go to previous message
GravyCode is currently offline  GravyCode
Messages: 2
Registered: June 2013
Karma:
Junior Member
On Friday, June 21, 2013 1:40:40 AM UTC+8, Twayne wrote:
> I'm a PHP near-newbie working fairly successfully on creating a secure
>
> PHP e-mail (mail()) function. It occurs to me that the only way a user
>
> knows (thinks) a form has been sent, is that I tell him so either in a
>
> line of code or with a Thank You page.
>
>
>
> With that in mind, is there any way with PHP to actually tell that a
>
> message was actually sent? That it at least was mailed out?
>
>
>
> I came across retval() and thought that might be way to do it, but I
>
> misinterpreted it, thinking it was a PHP function, which it turns out to
>
> not be. Therefore I'm looking for some way to authenticate that the
>
> e-mail actually left the server.
>
>
>
> Any suggestions?
>
>
>
> Thanks,
>
>
>
> Twayne`

I really like using PHPMailer, Create a mailer object with whatever settings you like, I usually run mine through gmail since I don't send many and they're mostly to myself.

https://github.com/Synchro/PHPMailer

//Setup
$mail = new PHPMailer();
$mail = $this->mail;
$mail->IsSMTP();
// enables SMTP debug information (for testing) // 1 = errors and messages // 2 = messages only
// $mail->SMTPDebug = 2;
$mail->SMTPAuth = true;
$mail->Host = 'ssl://smtp.gmail.com:465';
$mail->IsHTML(true); // send as HTML
$mail->Username = $account;
$mail->Password = $password;
$mail->FromName = $from;
//Sending
$mail->AddAddress($to);
$mail->Subject = $subject;
$mail->Body = $message; //HTML Body
if(!$mail->Send()){
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}

It gives Error messages, but what types and to what extend you might have to check yourself. But if you're using a foreign SMTP server it should be simpler to verify the message was sent, but you wont really know if it was received.

---

If you're just wanting to get user input for your own use and not sending data to others, you could simply add the data to a database - which you can confirm - then send an email with a link to yourself to view it. This way even if you don't receive the email you still have the data on the server. (You could also send the data in the email and store it on the server).

---

With a rather undetailed question as to your purposes and requirements, this is maybe the most helpful info I can provide while make some assumptions.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: strange one
Next Topic: how to change old ereg?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Jun 17 18:02:38 GMT 2024

Total time taken to generate the page: 0.06649 seconds