Hello!!

Sorry I missed you first post.

But you want an auto-email sent out after someone inserts data into the
database, Right??

And of course you want this to be transparent as much as you can.


So do your insert statements to the database then using an IF-ELSE statement
to check if the insert was successful, then in the IF statement-send your
email. 

Like this...

Blah blah blah

$result = mysql_query ($query, $db) or
                Die (Mysql_error());
$row_insert = Mysql_affected_rows();

If ($row_insert == 0){
        Echo "Sorry you Insert statement was unsuccessful...Please try
again";
}else{
        $CC = \"[EMAIL PROTECTED]";
                
        $text .= "This Automatic Email is to inform you that you insert
worked!!.\n";
        $text .= "\n";
        $text .= "Thank you... ";

        $subject = "Auto-email"; 
        
        $header = "From: $CC\nReply-To: $CC\n";
        $header .= "Cc: $CC\n";
        $header .= "MIME-Version: 1.0\n";
        $header .= "Content-Type: text/plain\n";
        $header .= "Content-Transfer-Encoding: 8bnoit\n\n";
        $header .= "$text\n";


mail($To, $subject, "", $header);

}


That should do it!!

And of course you should send some kind of feedback to the user, so they now
it worked as well.


I hope this helps. I know there are better ways of doing this, functions or
classes. But this is quick. 


Good luck!


Dan Brunner






-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 26, 2003 12:50 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Re: send email

Thanks to all for the input.  I will attempt to make this work.  I am
not a programmer but like to hack around when I can.  If I get lost I
will probably shoot another email out.
thanks,
DF


On Tue, 2003-11-25 at 16:24, Jack van Zanen wrote:
> Hi
> 
> 
> my example earlier does not show the email address in  the source of the
> displayed web page.
> It is in the source code, but you can change that to be put in a config
file
> and include this file in the script.
> 
> 
> Jack
> 
> -----Original Message-----
> From: howard gramer [mailto:[EMAIL PROTECTED]
> Sent: dinsdag 25 november 2003 21:09
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Re: send email
> 
> 
> I am in the same boat,
> ( I posted a couple of days ago Subject: Re: [PHP-DB] Send formmail data
to
> Email and Database ), not knowing where to put the Mail() into my own
code.
> I am working on it but no success yet.
> 
> But, my real question in this topic; with formmail.pl using Sendmail your
> able to use "recipients_alias = [EMAIL PROTECTED]" inside of the
> FormMail.conf file.  So this means you can hide the email address in the
> configuration file without it being seen in the page source.
> 
> How do you accomplish the same with Mail()? i.e. hiding the email
> 
> 
> howard grC$mer
>   New York City
>    [EMAIL PROTECTED]
> 
> 
> >From: "Kim Steinhaug" <[EMAIL PROTECTED]>
> >Reply-To: "Kim Steinhaug" <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >Subject: [PHP-DB] Re: send email
> >Date: Tue, 25 Nov 2003 19:57:44 +0100
> >
> >Well this shouldnt be any problem. I suspect you dont
> >know how to set up the email routine since your asking.
> >
> >All you need to do is insert a sendmail script together with the
> >update of the mySQL database. You could use PHPs internal
> >functions for this, but Ill recommend you using PHPmailer which
> >is heavily documentet with tons of examples on how to use.
> >
> >The PHPmailer is located at sourceforge and you should find it
> >right away. It has to be the most elegant way I know of sending
> >emails from PHP scripts.
> >
> >And as a bonus, the PHPmailer is under active development so
> >you will most likely never run into problems using it, :)
> >
> >--
> >Kim Steinhaug
> >---------------------------------------------------------------
> >There are 10 types of people when it comes to binary numbers:
> >those who understand them, and those who don't.
> >---------------------------------------------------------------
> >
> >
> >"Redhat" <[EMAIL PROTECTED]> wrote in message
> >news:[EMAIL PROTECTED]
> > > I have created a simple form that dumps input information into a mysql
> > > database.  The person that I created it for said it would be nice if
it
> > > would also notify him by email that an entry was added to the
database.
> > > I have no idea where to begin with that - any ideas?
> > > thanks,
> > > DF
> 
> _________________________________________________________________
> online games and music with a high-speed Internet connection!  Prices
start
> at less than $1 a day average.  https://broadband.msn.com (Prices may vary
> by service area.)
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to