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


Groups > comp.lang.php > #9806 > unrolled thread

FORMS, validating mail was sent

Started byTwayne <nobody@spamcop.net>
First post2013-06-20 13:40 -0400
Last post2013-06-21 11:30 -0700
Articles 2 on this page of 42 — 15 participants

Back to article view | Back to comp.lang.php


Contents

  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

Page 3 of 3 — ← Prev page 1 2 [3]


#9862

FromTwayne <nobody@spamcop.net>
Date2013-06-22 12:02 -0400
Message-ID<kq4hql$8l0$1@speranza.aioe.org>
In reply to#9822
On 2013-06-20 4:46 PM, Gordon Burditt 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.
>
> Since you're a near-newbie, please save the world from having to
> block email from your server, and DO NOT put any variables in email
> headers, DO NOT put any variables from the user in email headers,
> and DO NOT put any variables set in your form in email headers.
> Put them in the body of the mail.

All good information. FWIW, I'm not new to websites and contact forms. I 
have a couple I've used for years and never had a hack or any kind of 
problem with them.
    Due to a brain concussion I've lost all my PHP capabilities to 
memory loss and I'm currently using this query as a way to keep on 
relearning it. I've gotten some back, but not nearly enough to be 
considered as knowledgeable. I remember a lot of the concepts, but C or 
PHP actual coding just left for parts unknown.

>
> Wrong:		 From: $email
> Right:		 From: www-data@myserver.hostingco.com
>
> Some servers are going to require that (a) the From: address is
> local, (b) the From: address is a valid local user, and perhaps (c)
> the user name must match the user id of the code that called the
> MTA.  In other words, there might be only one correct From: line
> you're allowed to use.

Correct.
>
> (For a mailing list to customers, you're stuck with a variable
> in the To:, Cc:, or Bcc: headers.  )

To only: cc and bcc are not possible - on purpose.
>
> Wrong:		Subject: Contact form from $email
> Right:		Subject: Contact form - read body to tell who it's from.
>
> Wrong:		Subject: Order for $itemname
> Right:		Subject: Order

Done those, too.
>
>
>
> (Consider what happens if $email='me@gmail.com\rCc: victim1@gmail.com,
> victim2@gmail.com, victim3@gmail.com, ..., victim99@gmail.com', and
> $address (used in the body) contains a 5-page-long ad for body part
> enlargement)

Can't (shouldn't) happen without something pretty clever: Filters limit 
it to only one To: address, no code, etc. etc..

>
>>   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?D

Depends on your viewpoint: If you're the one filling out the form, the 
mail is "sent". If you're on the other end of the tunnel, the mail is 
"accepted"; THAT is the ACK I want to detect.

>
> The return value from the mail() function is about as good as you
> can get.  The mail was handed off to the MTA.
>
>> 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.
>
> It can actually take an incredible number of DNS lookups and alias
> file searches to determine if the mail is even *SUPPOSED* to leave
> the server (that is, the destination is not local to the server),
> especially since shared hosted web servers tend to have lots of
> different DNS hostnames all pointing at them.
>

No argument for a larger site; but it's only the "ACK" that a mail was 
accepted that I am looking for. Not that it was or will be delivered.

You have an interesting attitude & viewpoint; I think I like that.

Regards,

Twayne`

[toc] | [prev] | [next] | [standalone]


#9856

FromGravyCode <matty023@gmail.com>
Date2013-06-21 11:30 -0700
Message-ID<edf57165-7cdb-4a3f-a882-ef0320fb759d@googlegroups.com>
In reply to#9806
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.

[toc] | [prev] | [standalone]


Page 3 of 3 — ← Prev page 1 2 [3]

Back to top | Article view | comp.lang.php


csiph-web