Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #9856

Re: FORMS, validating mail was sent

Newsgroups comp.lang.php
Date 2013-06-21 11:30 -0700
References <kpveqo$9ag$2@speranza.aioe.org>
Message-ID <edf57165-7cdb-4a3f-a882-ef0320fb759d@googlegroups.com> (permalink)
Subject Re: FORMS, validating mail was sent
From GravyCode <matty023@gmail.com>

Show all headers | View raw


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.

Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

FORMS, validating mail was sent Twayne <nobody@spamcop.net> - 2013-06-20 13:40 -0400
  Re: FORMS, validating mail was sent Jerry Stuckle <jstucklex@attglobal.net> - 2013-06-20 13:53 -0400
  Re: FORMS, validating mail was sent "J.O. Aho" <user@example.net> - 2013-06-20 20:18 +0200
  Re: FORMS, validating mail was sent The Natural Philosopher <tnp@invalid.invalid> - 2013-06-20 19:24 +0100
    Re: FORMS, validating mail was sent Jerry Stuckle <jstucklex@attglobal.net> - 2013-06-20 14:40 -0400
    Re: FORMS, validating mail was sent gordonb.vb4vo@burditt.org (Gordon Burditt) - 2013-06-20 14:44 -0500
      Re: FORMS, validating mail was sent The Natural Philosopher <tnp@invalid.invalid> - 2013-06-20 22:03 +0100
      Re: FORMS, validating mail was sent Twayne <nobody@spamcop.net> - 2013-06-21 14:06 -0400
      Re: FORMS, validating mail was sent Twayne <nobody@spamcop.net> - 2013-06-22 11:42 -0400
      Re: FORMS, validating mail was sent Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-06-23 13:13 +0200
        Re: FORMS, validating mail was sent The Natural Philosopher <tnp@invalid.invalid> - 2013-06-23 12:22 +0100
          Re: FORMS, validating mail was sent Twayne <nobody@spamcop.net> - 2013-06-23 13:07 -0400
        Re: FORMS, validating mail was sent Twayne <nobody@spamcop.net> - 2013-06-23 13:00 -0400
          Re: FORMS, validating mail was sent "J.O. Aho" <user@example.net> - 2013-06-23 20:22 +0200
            Re: FORMS, validating mail was sent Twayne <nobody@spamcop.net> - 2013-06-23 14:53 -0400
        Re: FORMS, validating mail was sent gordonb.4qaft@burditt.org (Gordon Burditt) - 2013-06-24 14:43 -0500
          Re: FORMS, validating mail was sent "Peter H. Coffin" <hellsop@ninehells.com> - 2013-06-24 15:09 -0500
          Re: FORMS, validating mail was sent Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-06-25 15:19 +0200
            Re: FORMS, validating mail was sent Jerry Stuckle <jstucklex@attglobal.net> - 2013-06-25 10:11 -0400
              Re: FORMS, validating mail was sent Twayne <nobody@spamcop.net> - 2013-06-25 11:43 -0400
            Re: FORMS, validating mail was sent Twayne <nobody@spamcop.net> - 2013-06-25 11:32 -0400
            Re: FORMS, validating mail was sent gordonb.htsnc@burditt.org (Gordon Burditt) - 2013-06-27 10:57 -0500
              Re: FORMS, validating mail was sent Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-06-27 21:13 +0200
            Re: FORMS, validating mail was sent Arno Welzel <usenet@arnowelzel.de> - 2013-06-28 11:43 +0200
  Re: FORMS, validating mail was sent gordonb.k0cb7@burditt.org (Gordon Burditt) - 2013-06-20 15:46 -0500
    Re: FORMS, validating mail was sent Jerry Stuckle <jstucklex@attglobal.net> - 2013-06-20 17:03 -0400
      Re: FORMS, validating mail was sent gordonb.udxst@burditt.org (Gordon Burditt) - 2013-06-21 19:26 -0500
        Re: FORMS, validating mail was sent Jerry Stuckle <jstucklex@attglobal.net> - 2013-06-21 20:36 -0400
      Re: FORMS, validating mail was sent Twayne <nobody@spamcop.net> - 2013-06-22 12:04 -0400
    Re: FORMS, validating mail was sent Christoph Michael Becker <cmbecker69@arcor.de> - 2013-06-20 23:39 +0200
      Re: FORMS, validating mail was sent Tim Streater <timstreater@greenbee.net> - 2013-06-21 10:11 +0100
        Re: FORMS, validating mail was sent The Natural Philosopher <tnp@invalid.invalid> - 2013-06-21 11:25 +0100
          Re: FORMS, validating mail was sent Tim Streater <timstreater@greenbee.net> - 2013-06-21 12:27 +0100
            Re: FORMS, validating mail was sent The Natural Philosopher <tnp@invalid.invalid> - 2013-06-21 17:59 +0100
              Re: FORMS, validating mail was sent Tim Streater <timstreater@greenbee.net> - 2013-06-21 18:25 +0100
                Re: FORMS, validating mail was sent The Natural Philosopher <tnp@invalid.invalid> - 2013-06-21 23:43 +0100
                Re: FORMS, validating mail was sent Tim Streater <timstreater@greenbee.net> - 2013-06-22 13:45 +0100
          Re: FORMS, validating mail was sent Twayne <nobody@spamcop.net> - 2013-06-22 12:20 -0400
    Re: FORMS, validating mail was sent "Peter H. Coffin" <hellsop@ninehells.com> - 2013-06-20 17:27 -0500
      Re: FORMS, validating mail was sent The Natural Philosopher <tnp@invalid.invalid> - 2013-06-21 07:57 +0100
    Re: FORMS, validating mail was sent Twayne <nobody@spamcop.net> - 2013-06-22 12:02 -0400
  Re: FORMS, validating mail was sent GravyCode <matty023@gmail.com> - 2013-06-21 11:30 -0700

csiph-web