Results 1 to 6 of 6

Thread: Need some help.

  1. #1
    Join Date
    May 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need some help.

    I have a submit button that send the form to a 3rd party source, is there a way to add some code to it so that I can also have it sent to my own email. That way I dont have to constantly check the 3rd party site

    or would it be easier to create my own form and send the info in an email that way.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    You can't send it two places. It just goes to the action of the form. That page could do multiple things with the data, but you can't have that actually be two pages at the same time.
    You could write your own PHP script that would do both, though, if that sounds like a good option.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    What about trying Ajax for doing this job I mean to send the email to you.

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Grab the values of all the fields and send to a PHP mailer script via get (post?), using Ajax?

    Seems like a lot of work.

    I'd guess there's a better way to organize the whole system if we knew what you needed to do, overall.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    May 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I am doing the work for a Web Design Companies website that gets quote sent to them from a 3rd party source. (http://www.salesforce.com). The sales guy would like an email send to him with the same data that is sent to the 3rd party source. That way he doesnt have to check the 3rd party source after each submission.

    So what I would like is something that can do that? You guys mentioned using a php script? Can you give me an example of that? I dont know anything about AJAX so I am at a loss there.

    Thanks for the help.

  6. #6
    Join Date
    May 2007
    Location
    Sherman Texas
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Chris
    I stole this from an OS project called "Dandra Dev Snippets" - check SourceForge.net - the filename is sendmail.php and as you will see it's a couple of years old (No idea how long it's sat on my system - so it has probably been updated)

    Code:
    <?php  /* (c) Copyright 2000,2001, Stefan Morgenroth, dandra.network, http://dandra.org */
    	// $Id: sendmail.php,v 1.4 2001/11/04 23:29:53 dandra Exp $ , $Revision: 1.4 $
    
    	/****************************************************************************
    	 *
    	 * sendmail - sending e-mails through a HTML formular
    	 *
    	 ***************************************************************************/
    
    /**
     *	The following values should be submited by the HTML form
     *	or will be fixed by removing the comment trailing the concerning line
     **/
    // $maildomain = 'domain.org';
    // $recipient = 'contact';
    // $mailsubject = '';
    // $mailmessage = '';
    // $lastname = '';
    // $firstname = '';
    // $email = '';
    // $company = '';
    // $priority = 3;	// e-mail priority: 1: High, 3: Normal, 5: Low
    
    
    $thankspageurl = 'http://www.domain.org/thanks.html';
    
    // Text of error message
    $alerterror = 'You forgot:';
    $alerterror_missingfirstname = 'your first name!';
    $alerterror_missinglastname = 'your last name!';
    $alerterror_wrongemail = 'your valid e-mail address!';
    $str_back = 'Back to last page';
    
    
    //**** CHANGE THIS IF YOU WANT TO CHANGE THE MAIL RECIPIENTS ****//
    
    // for eg. contact@domain.org
    $targetuser[0] = 'contact'; // default recipient user
    $targetuser[1] = 'contact';
    $targetuser[2] = 'investors';
    $targetuser[3] = 'postmaster';
    $targetuser[4] = 'webmaster';
    $targetuser[5] = 'admin';
    
    
    
    //*********** DO NOT EDIT BEHIND THIS LINE ******************//
    
    
    /* recipients */
    /* to create multirecipient:
    	$recipient_mail .= "Mary <mary@u.college.edu>" . ", " ; // note the comma!
    	$recipient_mail .= "Kelly <kelly@u.college.edu>" . ", ";
    	$recipient_mail .= "anton@domain.org";
    */
    // Build e-mail out of the recipient keyword
    $recipient_mail == '';
    if ($recipient != '')
    {
    	switch ($recipient)
    	{
    		case $targetuser[1]:	// e.g. mail to contact@domain.org
    			$recipient_mail = '"'.$recipient.'" <'.$recipient.'@'.$maildomain.'>';
    		break;
    		case $targetuser[2]:	// e.g. mail to investors@domain.org
    			$recipient_mail = '"'.$recipient.'" <'.$recipient.'@'.$maildomain.'>';
    		break;
    		case $targetuser[3]:	// e.g. mail to postmaster@domain.org
    			$recipient_mail = '"'.$recipient.'" <'.$recipient.'@'.$maildomain.'>';
    		break;
    		case $targetuser[4]:	// e.g. mail to webmaster@domain.org
    			$recipient_mail = '"'.$recipient.'" <'.$recipient.'@'.$maildomain.'>';
    		break;
    		case $targetuser[5]:	// e.g. mail to admin@domain.org
    			$recipient_mail = '"'.$recipient.'" <'.$recipient.'@'.$maildomain.'>';
    		break;
    		default:
    		{
    			$recipient = $targetuser[0];	// mail to contact@domain.org
    			$recipient_mail = '"'.$recipient.'" <'.$recipient.'@'.$maildomain.'>';
    		}
    	}
    }
    
    
    /* subject */
    // $subject = "Birthday Reminders for August";
    // Build a structured subject
    $subject = $maildomain.' > '.$recipient.' > '.substr($mailsubject, 0, 20);
    
    
    /* message */
    // Build the complex mailbody
    /*
    $message .= "The following email includes a formatted ASCII table\n";
    $message .= "Day \t\tMonth \t\tYear\n";
    $message .= "3rd \t\tAug \t\t1970\n";
    $message .= "17rd\t\tAug \t\t1973\n";
    */
    $message = '';
    $message .= "\n";
    $message .= $mailmessage;
    $message .= "\n\n";
    
    /* you can add a special signature */ 
    /*
    $message .= "--\r\n"; //Signature delimiter
    $message .= "Birthday reminder copylefted by public domain";
    */
    $message .= "___________________________\r\n"; //Signature delimiter
    $message .= "dandra.sendertracking\r\n";
    $message .= 'Referrer: '.getenv('HTTP_REFERER')."\n";
    $message .= 'Browser: '.getenv('HTTP_USER_AGENT')."\n";
    $message .= "RemoteAddr: ".getenv('REMOTE_ADDR');
    $message .= "\t RemoteHost: ".getenv('REMOTE_HOST')."\n";
    
    
    /* additional header pieces for errors, From cc's, bcc's, etc */
    /*
    $headers = "From: contact@domain.org"; // From to
    $headers .= "cc: webmaster@domain.org\n"; // CC to
    $headers .= "bcc: postmaster@domain.org, admin@php.net\n"; // BCCs to
    $headers .= "X-Sender: <sender@anotherdomain.org>\n"; 
    $headers .= "X-Mailer: dandra.network.mailer\n"; // mailer
    $headers .= "X-Priority: 1\n"; // Urgent message!
    $headers .= "Return-Path: <birthday@php.net>\n";  // Return path for errors
    */
    /*
    */
    
    
    if (($lastname != '') && ($firstname != '') && (($email != '') && ((strpos($email, '@') >= 2) && (strrpos($email, '.') >= 4))))
    {
    	$sender_email = $email;
    	$headers = '';
    	$headers .= 'From: "'.$lastname.', '.$firstname.', '.$company.'" <'.$sender_email.'>'."\n";
    	// $headers .= 'Cc: "'.$name.', '.$vorname.', '.$firma.'" <'.$sender_email.'>'."\n";
    	// $headers .= 'Bcc: "'.$name.', '.$vorname.', '.$firma.'" <'.$sender_email.'>'."\n";
    	$headers .= "X-Sender: <".$sender_email.">\n";
    	$headers .= "X-Mailer: dandra.network.mailer.PHP".phpversion()."\n"; // mailer ID
    	$headers .= "User-Agent: ".getenv('HTTP_USER_AGENT')."\n";
    
    	/*
    		// Priority Level for the e-mail
    
    		X-Priority: 1
    		X-MSMail-Priority: High
    		X-Priority: 3
    		X-MSMail-Priority: Normal
    		X-Priority: 5
    		X-MSMail-Priority: Low
    
    		$headers .= "X-Priority: 1\n"; // Urgent message!
    		$headers .= "X-Priority: 3\n";
    		$headers .= "X-MSMail-Priority: Normal\n";
    	*/
    	switch ($priority)
    	{
    		case 1:
    			$headers .= "X-Priority: 1\n";
    			$headers .= "X-MSMail-Priority: High\n";
    		break;
    		case 3:
    			$headers .= "X-Priority: 3\n";
    			$headers .= "X-MSMail-Priority: Normal\n";
    		break;
    		case 5:
    			$headers .= "X-Priority: 5\n";
    			$headers .= "X-MSMail-Priority: Low\n";
    		break;
    		default:
    		{
    			$headers .= "X-Priority: 3\n";
    			$headers .= "X-MSMail-Priority: Normal\n";
    		}
    	}
    	$headers .= "Return-Path: <".$sender_email.">\n";  // Return path for errors
    
    	/* If you want to send html mail, uncomment the following line */
    	// $headers .= "Content-Type: text/html; charset=iso-8859-1\n"; // Mime type
    
    	/* and now mail it */
    	// mail($recipient, $subject, $message, $headers);
    	if ($recipient_mail != '')
    	{
    		// mail($recipient_mail, $subject, $message, $headers);
    		if (mail($recipient_mail, $subject, $message, $headers))
    		{
    			header('Location: '.$thankspageurl);
    		}
    	}
    
    }
    else
    {
    	$alerterror_out = '';
    	echo '<script language="JavaScript">';
    	$alerterror_out .= $alerterror.' ';
    	echo "alert('  ".$alerterror_out;
    	if ($lastname == '')
    	{
    		// $alerterror_out .= $alerterror_missinglastname;
    		// $alerterror_out .= $alerterror_out.' ';
    		echo $alerterror_missinglastname.' ';
    	}
    	if ($firstname == '')
    	{
    		// $alerterror_out .= $alerterror_missingfirstname;
    		// $alerterror_out .= $alerterror_out.' ';
    		echo $alerterror_missingfirstname.' ';
    	}
    	if ((strpos($email, '@') < 2) && (strrpos($email, '.') < 4))
    	{
    		// $alerterror_out .= $alerterror_wrongemail;
    		// $alerterror_out .= $alerterror_out.' ';
    		echo $alerterror_wrongemail.' ';
    	}
    	echo "  ');";
    	// echo "alert('  ".$alerterror_out."  ');";
    	echo 'history.back();';
    	echo '</script>';
    	echo '<noscript>';
    	echo '<h2>'.$alerterror_out;
    	if ($lastname == '')
    	{
    		// $alerterror_out .= $alerterror_missinglastname;
    		// $alerterror_out .= $alerterror_out.' ';
    		echo $alerterror_missinglastname.' ';
    	}
    	if ($firstname == '')
    	{
    		// $alerterror_out .= $alerterror_missingfirstname;
    		// $alerterror_out .= $alerterror_out.' ';
    		echo $alerterror_missingfirstname.' ';
    	}
    	if ((strpos($email, '@') < 2) && (strrpos($email, '.') < 4))
    	{
    		// $alerterror_out .= $alerterror_wrongemail;
    		// $alerterror_out .= $alerterror_out.' ';
    		echo $alerterror_wrongemail.' ';
    	}
    	echo '</h2>';
    	echo '<h3><a href="'.$HTTP_REFERER.'" title="'.$str_back.'">'.$str_back.'</a></h3>';
    	echo '</noscript>';
    }

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •