I have created a Mysql data and a PHP form in order to enetr the data in mysql

I would like the same time the user fillin his data to recieve a mail with the data in txt or csv form

I am sending you the form

    There are several mail functions available in PHP and PEAR.

    I use phpMailer

    require_once( 'PEAR.php' );
    require_once('class.phpmailer.php');
    
    // New instance
    $mail = new PHPMailer();
    
    /* phpmailer can send email as HTML or plain text or both */
    // Create the HTML version of the email
    $mHtml = "HTML formatted email here";
    
    // Create the plain text version of the email
    $mText = 'txt version';
    
    // Setup the mail
    $mail->From = 'me@myaddress.com';   // Senders address
    $mail->FromName = 'My Name';            // Senders display name
    $mail->Subject = 'My Text Mail';            // Subject for the mail
    $mail->IsHTML(true);                            //  Flag whether your sending HTML or not
    $mail->Body = $mHtml;                        //  Attach the HTML part if you're using it
    $mail->AltBody = $mText;                    //  Attach a plain text alternative
    $mail->AddAddress( 'someone@somebody.com', 'Some Person' );	// Add an address.  Call this to add more addresses
    
    /* You can add attachments */
    // Add an attachment, ike the string contents of a PDF file
    $mail->AddStringAttachment($PDFString, 'Filename.pdf', 'base64', 'application/x-pdf');
    // Perhaps add a HTML attachment
    $mail->AddStringAttachment($htmlAttachment, 'sample.html', 'base64', 'text/html');
    
    // Send the mail and check for a PEAR Error
    if( PEAR::isError( $rtn = $mail->Send() ) ) {
       // Do something with the error
       print_r( $rtn->getMessage() );
    }
    

    But you could use PHP mail() command, only I personaly find it unstable and can often be marked as spam.

      Write a Reply...