PHP - Smtp: Failed To Set Sender
I'm having a rough time getting an AS3 application working with a PHP script.
The PHP script takes POST variables and then sends an email using SMTP. When running it through a standard HTML form, the PHP side works perfectly. However, when I send the exact same POST variables through AS3 to the script, I get this error. Failed to set sender: phpemailtesting@gmail.com [SMTP: Failed to write to socket: not connected (code: -1, response: )] So, I'm not really sure what the issue is here... Here's some code that might help. //print_r($_POST); require_once('Mail-1.2.0/Mail.php'); $from = isset($_POST['emailfrom']) ? $_POST['emailfrom'] : ''; $to = isset($_POST['emailsubject']) ? $_POST['emailto'] : ''; $bcc = isset($_POST['bcc'])? $_POST['bcc'] : ''; $subject = isset($_POST['emailsubject']) ? $_POST['emailsubject'] : ''; $body = isset($_POST['emailbody']) ? $_POST['emailbody'] : ''; $ssl = isset($_POST['ssl']) ? $_POST['ssl'].'://' : ''; $smtp_server = isset($_POST['smtpserver']) ? $_POST['smtpserver'] : ''; $password = isset($_POST['emailpassword']) ? $_POST['emailpassword'] : ''; $port = isset($_POST['port']) ? $_POST['port'] : ''; $success_counter = 0; $fail_counter = 0; $bigerror; if($from!='' && $to!='' && $subject!='' && $body!='' && $smtp_server!='' && $password!='' && $port!='') { if($bcc!='') { $bcc_array = explode(',',$bcc); } $host = $ssl . $smtp_server; $smtp = Mail::factory('smtp', array('host'=>$host, 'port'=>$port, 'auth'=>true, 'username'=>$from, 'password'=>$password)); $header = array('From'=>$from, 'To'=>$to, 'Subject'=>$subject); $mail = $smtp->send($to, $header, $body); if (PEAR::isError($mail)) { $bigerror = $mail->getMessage(); $fail_counter++; //echo("<p>Message failed".$to." :<br />" . $mail->getMessage() . "</p>"); } else { $success_counter++; //echo("<p>Message successfully sent to <b>". $to ."</b>!</p>"); } for($counter=0; $counter<count($bcc_array) && $counter<=99; $counter++) { $header = array('From'=>$from, 'To'=>$bcc_array[$counter], 'Subject'=>$subject); $mail = $smtp->send($bcc_array[$counter], $header, $body); if (PEAR::isError($mail)) { $bigerror = $mail->getMessage(); //echo("<p>Message failed".$bcc_array[$counter]." :<br />" . $mail->getMessage() . "</p>"); $fail_counter++; } else { //echo("<p>Message successfully sent to <b>". $bcc_array[$counter] ."</b>!</p>"); $success_counter++; } } //echo "<br /><br />Successful emails: " . $success_counter; //echo "<br />Failed emails: " . $fail_counter; echo $success_counter.",".$fail_counter.",".$bigerror; } else { echo "error"; //echo '<p>Some information is missing, please try again!</p>'; } Then, the AS if anybody's interested in seeing it. Code: [Select] //Create loader to load emailer.php var loader:URLLoader = new URLLoader(); var request:URLRequest = new URLRequest("http://tendollartools.com/testmail/emailer.php"); //Create POST variables var variables:URLVariables = new URLVariables(); variables.emailfrom = preferences["smtpLogin"]; variables.emailto = preferences["smtpLogin"]; variables.smtpserver = preferences["smtpServer"]; variables.emailpassword = preferences["smtpPassword"]; variables.ssl = preferences["smtpSSL"]; variables.port = preferences["smtpPort"]; variables.bcc = emails; variables.emailsubject = preferences["emailSubject"]; variables.emailbody = preferences["emailBody"]; //Set method to POST and set variables as the vars to send to emailer.php request.method = URLRequestMethod.POST; request.data = variables; //Load emailer.php and run the onEmailComplete function when finished loading loader.dataFormat = URLLoaderDataFormat.TEXT; loader.addEventListener(Event.COMPLETE, onEmailComplete); loader.load(request); The preferences object has all the correct information in it... so this is where I'm confused. Why will the exact same POST information work from an HTML form, but not when sent through AS? Similar TutorialsHave actually tried this mailer on localhost and it worked perfectly. Now am trying to use it on online but it's giving this error
SMTP-> ERROR: Failed to connect to server: Connection timed out (110)
SMTP -> ERROR: Could not connect to SMTP host. Mailer Error: SMTP Error: Could not connect to SMTP Host.
please how do i fix this?
include "classes/class.phpmailer.php"; // include the class name $mail = new PHPMailer(); // create a new object $mail->IsSMTP(); // enable SMTP $mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only $mail->SMTPAuth = true; // authentication enabled $mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail $mail->Host = "smtp.gmail.com"; $mail->Port = 465; // or 587 $mail->IsHTML(true); $mail->Username = "hypropsict@gmail.com"; $mail->Password = "hyprops123"; $mail->SetFrom("hypropsict@gmail.com"); $mail->Subject = "Requisition Processed"; $mail->Body = "<b>Hello $firstname, your requisition has been processed and Approved.. <br/><br/>Come to the Account department to recieve your $text . <br/> Thank You </b>"; $mail->AddAddress($email); if(!$mail->Send()){ echo "Mailer Error: " . $mail->ErrorInfo; } Hi guys I am a newbie with PHP and I have been trying to solve this problem for 3 days.. Ive set up a booking form on my website to be sent directly to my email once the client clicked on the send button.. The problem I am having while checking these pages on wamp is that the booking form is ok but when I click on the send button the following message error appears "Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\fluffy_paws\booking_form2.php on line 27" When I check online I have this message "500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed." Are my codes wrong??? My webhosting is Blacknight.com , Im on Windows Vista, my internet is a dongle with O2 ireland Thanks for your help! Hi I am trying to send email through following php code to may gmail account but it givrs me SMTP Error: Could not connect to SMTP host.
*******************************************************************************************************************************************************
<?phpif(isset($_POST['submit'])){ $message='Full Name: '.$_POST['fullname'].'<br />Subject: '.$_POST['subject'].'<br />Phone: '.$_POST['phone'].'<br />Email: '.$_POST['emailid'].'<br />Comments: '.$_POST['comments'].''; require "phpmailer/class.phpmailer.php"; //include phpmailer class // Instantiate Class $mail = new PHPMailer(); // Set up SMTP $mail->IsSMTP(); // Sets up a SMTP connection $mail->SMTPAuth = true; // Connection with the SMTP does require authorization $mail->SMTPSecure = "ssl"; // Connect using a TLS connection $mail->Host = "smtp.gmail.com"; //Gmail SMTP server address $mail->Port = 465; //Gmail SMTP port $mail->Encoding = '7bit'; // Authentication $mail->Username = "myemail@gmail.com"; // Your full Gmail address $mail->Password = "mypassword"; // Your Gmail password // Compose $mail->SetFrom($_POST['emailid'], $_POST['fullname']); $mail->AddReplyTo($_POST['emailid'], $_POST['fullname']); $mail->Subject = "New Contact Form Enquiry"; // Subject (which isn't required) $mail->MsgHTML($message); // Send To $mail->AddAddress("myemail@gmail.com", "Recipient Name"); // Where to send it - Recipient $result = $mail->Send(); // Send! $message = $result ? 'Successfully Sent!' : 'Sending Failed!'; unset($mail); }?><html><head> <title>Contact Form</title></head><body> <div style="margin: 100px auto 0;width: 300px;"> <h3>Contact Form</h3> <form name="form1" id="form1" action="" method="post"> <fieldset> <input type="text" name="fullname" placeholder="Full Name" /> <br /> <input type="text" name="subject" placeholder="Subject" /> <br /> <input type="text" name="phone" placeholder="Phone" /> <br /> <input type="text" name="emailid" placeholder="Email" /> <br /> <textarea rows="4" cols="20" name="comments" placeholder="Comments"></textarea> <br /> <input type="submit" name="submit" value="Send" /> </fieldset> </form> <p><?php if(!empty($message)) echo $message; ?></p> </div> </body></html> Firstly I'd like to say a hello to everyone. OK, I'm having a problem with my PHPMailer setup. My aim is to have a registration email sent to a user upon sign up from (admin@mydomain.com). I have set up my mail servers set up correctly. so I can send/recieve mail from (admin@mydomain.com). I am using PHPMailer_v5.1, and am using the following code Code: [Select] <?php error_reporting(E_ALL); ini_set('display_errors', 1); require_once('../class.phpmailer.php'); $mail = new PHPMailer(); $body = file_get_contents('contents.html'); $body = eregi_replace("[\]",'',$body); $mail->IsSMTP(); $mail->Host = "admin@mydomain.com"; $mail->SMTPDebug = 1; $mail->SMTPAuth = true; $mail->SMTPSecure = "ssl"; $mail->Host = "admin@mydomain.com"; $mail->Port = 25; $mail->Username = "admin@mydomain.com"; $mail->Password = "*****"; $mail->SetFrom('admin@mydomain.com","My Domain'); $mail->AddReplyTo("admin@mydomain.com","My Domain"); $mail->Subject = "PHPMailer Test Subject via smtp, basic with authentication"; $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; $mail->MsgHTML($body); $address = "test@test.com"; $mail->AddAddress($address, "Test"); if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message sent!"; } ?> I set up a PHP document to test this mail feature, but every time I load it, it displays this SMTP -> ERROR: Failed to connect to server: (0) SMTP Error: Could not connect to SMTP host. Mailer Error: SMTP Error: Could not connect to SMTP host. The PHPMailer is running on Elastiks (CentOS Linux 5.6). I cross checked the php.ini file and the OpenSSL is enabled. openssl OpenSSL support enabled OpenSSL Version OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008 Please help me out from these issue. Thanks for your time guys, hope someone can get back to me soon! Hey! I am trying to get a database table of users but am running into the error: Warning: file_get_contents(http://protege-ontology-editor-knowledge-acquisition-system.136.n4.nabble.com/template/NamlServlet.jtp?macro=user_nodes&user=68583) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 500 in get_user_from_parameter(nabble:utilities.naml:890) - <n.get_user_from_parameter.as_user_page.do/> - public v in C:\xampp\htdocs\website4js\stanford\loadUsernames.php on line 32 I have looked it up and it may be a security thing...The urls I am getting are http://protege-ontology-editor-knowledge-acquisition-system.136.n4.nabble.com/template/NamlServlet.jtp?macro=user_nodes&user=68583 but the error adds an nodes& part that screws it up. Any way around this? Code: [Select] <?PHP $maxPage = 0; $mainPage = "http://protege-ontology-editor-knowledge-acquisition-system.136.n4.nabble.com/template/NamlServlet.jtp?macro=app_people&node=136"; $mainContent = file_get_contents($mainPage); $pattern = "/(?<=\"Page )\d\d+/"; preg_match_all($pattern, $mainContent, $pageNumb); //find the max page for($i=0;$i<sizeof($pageNumb[0]);$i++) { if($pageNumb[0][$i] > $maxPage) { $maxPage = $pageNumb[0][$i]; } } //echo('Max page is: '.$maxPage.'\n'); //Get an array of all the pages $pages = array(); for($i=1;$i<$maxPage;$i++) { $pages[$i] = "http://protege-ontology-editor-knowledge-acquisition-system.136.n4.nabble.com/template/NamlServlet.jtp?macro=app_people&node=136&i=".($i*20); } //print_r($userPages); //Get personal page urls and add to MySQL mysql_connect("localhost" , "root") or die("Cant connect"); mysql_select_db("protegeusers") or die("Cant find database"); foreach($pages as $url) { $urlContents = file_get_contents($url); $pattern = "/http:\/\/protege-ontology-editor-knowledge-acquisition-system\.136\.n4\.nabble\.com\/template\/NamlServlet\.jtp\?macro=.+;user=\d+/"; preg_match_all($pattern, $urlContents, $personalPage); foreach($personalPage as $user) { for($i=0; $i<sizeof($user);$i++) { [color=green]$userContents = file_get_contents($user[$i]);[/color] $pattern1 = "/user\/SendEmail\.jtp\?type=user.+;user=\d+/"; $pattern2 = "/(?<=\">Send Email to ).+(?=<)/"; preg_match_all($pattern1, $userContents, $userEmail); preg_match_all($pattern2, $userContents, $username); [color=green]print_r($username); print_r($email);[/color] //$query = "INSERT INTO users (username, userurl) values ('$userName','$userUrl')"; //mysql_query($query); } } } ?> I am trying to figure how to code around this. I have a DOM scraper function that pulls urls from my database, opens the page, scrapes the data, and then moves onto the next URL to scrape. my issue is that if the page fails to load the script bombs and I have to restart it again. Trying to figure out how if the Code: [Select] $html->find('div[class="itemHeader address"]') as $div fails to open the page it just skips the DOM inspection. Here is my error... Failed to open stream: HTTP Request failed. Here is where I am at with my script.... Code: [Select] mysql_select_db("scraped") or die(mysql_error()); $result = mysql_query("SELECT PKEY, URL, HASSCRAPED, SHOULDSCRAPE FROM CRAWLED WHERE SHOULDSCRAPE ='1' AND HASSCRAPED = '0'") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { mysql_query("UPDATE CRAWLED SET CRAWLED.HASSCRAPED = '1' WHERE CRAWLED.URL = '" . $row['URL'] . "'"); $html = file_get_html($row['URL']); foreach($html->find('div[class="itemHeader address"]') as $div) { foreach($div->find('a') as $element){ $CleanData = CleanData($element->innertext); if (strlen($CleanData[0]) > 5){ mysql_query("INSERT INTO SCRAPED (ADDR1, CITY, STATE, ZIP, URL, DATE) VALUES ('" . $CleanData[0] . "','" . $CleanData[1] . "','" . $CleanData[2] . "','" . $CleanData[3] . "','". $row['URL'] . "','". date( 'Y-m-d H:i:s ' ) ."')"); } } } $html->clear(); unset($html); unset($CleanData); } function CleanData($data) { $NewData = trim($data); $NewData = str_replace("<em>", "", $NewData); $AddrCityStateZip = explode("</em>",$NewData); $CityStateZip = explode(",",$AddrCityStateZip[1]); $StateZip = explode(' ',$CityStateZip[1]); $NewDataArray = array ($AddrCityStateZip[0], $CityStateZip[0], $StateZip[1], $StateZip[2]); return $NewDataArray; unset($NewData); unset($AddrCityStateZip); unset($CityStateZip); unset($StateZip); } mysql_close($link); echo 'Scraping has compleated without error'; Here i have attached PHP contact form.Anyone filled this form and then need to go email to the admin . as example admin uses example@gmail.com as his email address... how can i do this ? in simply when i filledout this form and click Submit button then that information need to go admins email address(example@gmail.com ) Thanks [attachment deleted by admin] Hi I have sms website and i have add one button to my all single post button is working but the problem is the send button is going on another page i have create this code <form action="http://uksmsserver.ismspoetry.com/" method="post"> <input name="go-content" type="hidden" value="<?php echo $new_content; ?>" /><div id="button"><input type="submit" value="Send this Sms to Mobile" /></div></form> but i want to do i Wanna send single sms to This Page I have add This Sender In Iframe And The Sender Scprit is showing on this page http://ismspoetry.co...united-kingdom/ so i want to do if someone click on send sms to mobile button the msg goes will be on this sender if some one know please let me know thanks I want to be able to reply to the sender of the information ( the guy who fills the form online ). your help is much appreciated. here's the code <?php if(isset($_POST['submit'])) { $from = 'From: contactform@nisbetplantation.com'; $to = "reservations@nisbetplantation.com"; $subject = "Website Contact Form"; $name_field = $_POST['name']; $email_field = $_POST['email']; $address_field = $_POST['address']; $address2_field = $_POST['address2']; $city_field = $_POST['city']; $state_field = $_POST['state']; $zip_field =$_POST['zip']; $company_field =$_POST['company']; $IATA_field =$_POST['IATA']; $phone_field =$_POST['phone']; $fax_field =$_POST['fax']; $mail_from="$email"; $response1_field =$_POST['response1']; $areacode_field =$_POST['areacode']; $comments_field =$_POST['comments']; $body = "From: $name_field\n E-Mail: $email_field\n Address:\n $address_field Address2:\n $address2_field City:\n $city_field State:\n $state_field Zip:\n $zip_field Company:\n $company_field IATA:\n $IATA_field Phone:\n $phone_field Fax:\n $fax_field Visited Resort:\n $response1_field Area code:\n $areacode_field Comments:\n $comments_field'"; echo "Your Information has been submitted to $to!"; mail($to, $subject, $body); } else { echo "Please try again after some time..."; } ?> in my php mail i use this code: $success = mail($EmailFrom, $Subject, $Body2, "From: <$EmailTo>"); and here are the variables for emial from and email to, $EmailFrom = Trim(stripslashes($_POST['email'])); $EmailTo = "info@mydomain.co"; when the email is received the sender just appears as info@mydomain.co how can i have it say MSUKGroup Auto Responder or something? instead of just repeat the address? Hello dear guys, I have this code below which is to send SMS to single mobile No, but i am willing to send this message to the whole table of mobiles that i have please help, with thanks in advance <? $url="https://www.GATEWAYSITE"; $login="LOGIN"; $pwd="PSWD"; $mittente="CO"; $numero="$cellulare"; $testo=urlencode($messaggio); $y="login=".$login."&pwd=".$pwd."&testo=".$testo."&numero=".$numero."&mittente =".$mittente; $contents = @file_get_contents($url."?".$y); print $contents; ?> well... some part works! when i check my email, it says "nobody" instead of the senders email and it is not showing the right subject and the company field wont show up here is my html code thanks ~ Code Quote <form action="contact.php" method="POST" id="contactform"> <ol> <li> <label for="name">First Name <span class="red">*</span></label> <input id="name" name="name" class="text" /> </li> <li> <label for="email">Your email <span class="red">*</span></label> <input id="email" name="email" class="text" /> </li> <li> <label for="company">Company</label> <input id="company" name="company" class="text" /> </li> <li> <label for="subject">Subject</label> <input id="subject" name="subject" class="text" /> </li> <li> <label for="message">Message <span class="red">*</span></label> <textarea id="message" name="message" rows="6" cols="50"></textarea> </li> <li class="buttons"> <input type="image" name="imageField" id="imageField" src="images/send.gif" class="send" /> <div class="clr"></div> </li> </ol> </form> here is my php Code <?php if(!$_POST) exit; $email = $_POST['email']; //$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS'; if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email )){ $error.="Invalid email address entered"; $errors=1; } if($errors==1) echo $error; else{ $values = array ('name','email','message'); $required = array('name','email','message'); $your_email = "gilbylu@gmail.com"; $email_subject = "New Message: ".$_POST['subject']; $email_content = "new message:\n"; foreach($values as $key => $value){ if(in_array($value,$required)){ if ($key != 'subject' && $key != 'company') { if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; } } $email_content .= $value.': '.$_POST[$value]."\n"; } } if(@mail($your_email,$email_subject,$email_content)) { echo 'Message sent!'; } else { echo 'ERROR!'; } } ?> hello PHP geniuses! I am new to this whole thing... so please be patient with me I have a form that is working great.... there are just a couple of things that I would like it to do that I can't figure out. PHP is still a mystery to me, but I am trying to learn. If I include the code, I am hoping someone can help. I would like to know if I can 1. cc the sender the form details 2. pull form data to create the subject line This is a HiQform, with attachments... My HTML: Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Studio Job Ticket</title> <link rel="stylesheet" type="text/css" href="view.css" media="all"> <script type="text/javascript" src="view.js"></script> <script type="text/javascript" src="calendar.js"></script> </head> <body id="main_body" > <img id="top" src="top.png" alt=""> <div id="form_container"> <h1><a>Studio Job Ticket</a></h1> <form id="studio job ticket" class="appnitro" enctype="multipart/form-data" method="post" action="HiQFM.php"> <div class="form_description"> <input type=hidden name="recipient" value="dayle_sheward@rogers.com,dayle.sheward@juniperpark.com"> <input type="hidden" name="redirect" value="http://dayle.me/form/thankyou.html"> <input type="hidden" name="form_format" value="html"> <input type="hidden" name="MAX_FILE_SIZE" value="1000000"> <input type="hidden" name="path_to_file" value="http://dayle.me/form/TEMP_FILES"> <input type="hidden" name="subject" value="Studio Job Ticket"> <input type=hidden name="style_sheet" value="view.css"> <br /> <h2>Studio Job Ticket</h2> <p>The purpose of this form is to ensure the Juniper Park Studio receives all necessary files and information needed for dockets to be done in timely and accurate fashion. Please provide as <br /> much information as possible.</p> <p>Once this job ticket is received, you will be contacted by phone or email, confirming your job is <br /> in progress, with a rough estimate on when you can expect the first proof. </p> </div> <ul > <li class="description" id="li_1" > <label class="description" for="account manager">Account Manager</label> <span> <input id="first name" name= "first name" class="element text" maxlength="255" size="10" value=""/> <label>First</label> </span> <span> <input id="last name" name= "last name" class="element text" maxlength="255" size="14" value=""/> <label>Last</label> </span> </li> <li id="li_2" > <label class="description" for="email">Email</label> <div> <input id="email" name="email" class="element text" type="text" maxlength="255" value=""/> </div> </li> <li id="li_3" > <label class="description" for="job">Job</label> <span> <input id="client" name= "client" class="element text" maxlength="255" size="8" value=""/> <label>Client</label> </span> <span> <input id="brand" name= "brand" class="element text" maxlength="255" size="14" value=""/> <label>Brand</label> </span> </li> <li id="li_4" > <label class="description" for="media type">Media Type</label> <div> <select class="element select medium" id="media type" name="media type"> <option value=""selected="selected"></option> <option value="Award Work" >Awards Work</option> <option value="Collateral" >Collateral</option> <option value="OOH" >OOH</option> <option value="Print" >Print</option> <option value="Retouching" >Retouching</option> <option value="Photography" >Photography</option> </select> </div> </li> <li id="li_5" > <label class="description" for="docket">Docket (work cannot start without this)</label> <div> <input id="docket" name="docket" class="element text" type="text" maxlength="255" value=""/> </div> </li> <li id="li_6" > <label class="description" for="job">Creative Team</label> <span> <input id="AD" name= "AD" class="element text" maxlength="255" size="14" value=""/> <label>AD</label> </span> <span> <input id="Writer" name= "Writer" class="element text" maxlength="255" size="14" value=""/> <label>Writer</label> </span></li> <li id="li_7" > <label class="description" for="Supplied">Additional Information to Supply</label> <span> <input id="copy deck" name="copy deck" class="element checkbox" type="checkbox" value="1" /> <label class="choice" for="element_6_1">Copy Deck</label> <input id="spec sheet" name="spec sheet" class="element checkbox" type="checkbox" value="1" /> <label class="choice" for="element_6_2">Spec Sheet</label> <input id="ma" name="ma" class="element checkbox" type="checkbox" value="1" /> <label class="choice" for="element_6_3">MA</label> <input id="creative files" name="creative files" class="element checkbox" type="checkbox" value="1" /> <label class="choice" for="element_6_3">Creative Files</label> Please specify location files:</span></li> <li > <div> <input id="creative file location" name="creative file location" class="element text" type="text" maxlength="255" value=""/> or<br /> <input id="emailedYN" name="emailedYN" class="element checkbox" type="checkbox" value="1" /> <label class="choice" for="emailedYN">Check if to be Emailed</label> </div> </li> <li id="li_7" > <label class="description" for="upload">Upload a File </label> <div> <input id="attachment" name="attachment[]" class="element file" type="file"/> </div> </li> <li id="li_3" > <label class="description" for="due date">Due Date </label> <span> <input id="element_3_1" name="MM" class="element text" size="2" maxlength="2" value="" type="text"> / <label for="element_3_1">MM</label> </span> <span> <input id="element_3_2" name="DD" class="element text" size="2" maxlength="2" value="" type="text"> / <label for="element_3_2">DD</label> </span> <span> <input id="element_3_3" name="YYYY" class="element text" size="4" maxlength="4" value="" type="text"> <label for="element_3_3">YYYY</label> </span> <span id="calendar_3"> <img id="cal_img_3" class="datepicker" src="calendar.gif" alt="Pick a date."> </span> <script type="text/javascript"> Calendar.setup({ inputField : "element_3_3", baseField : "element_3", displayArea : "calendar_3", button : "cal_img_3", ifFormat : "%B %e, %Y", onSelect : selectDate }); </script> <li id="li_10" > <label class="description" for="element_10">Production Details</label> <div class="left"> <input id="trim" name="trim" class="element text" value="" type="text"> <label for="trim">Trim Size (width x height)</label> </div> <div class="right"> <input id="live" name="live" class="element text" value="" type="text"> <label for="live">Live (width x height)</label> </div> <div class="left"> <input id="bleed" name="bleed" class="element text" value="" type="text"> <label for="bleed">Bleed (width x height)</label> </div> <div class="right"> <input id="#mechanicals" name="#mechanicals" class="element text" value="" type="text"> <label for="#mechanicals"># of Mechanicals (if multiple, please provide a MA or spreadsheet)</label> </div> <div class="left"> <input id="die line" name="die line" class="element text" value="" type="text"> <label for="die line">Die Line</label> </div> <div class="right"> <input id="PU docket" name="PU docket" class="element text" value="" type="text"> <label for="PU docket">Pick-Up docket</label> </div> <div class="left"> <input id="FilesReq" name="FilesReq" class="element text" maxlength="15" value="" type="text"> <label for="FilesReq">To supply raw collected files or PDFX1a</label> </div> <div class="right"> <select class="element select medium" id="delivery" name="delivery" onClick='alert("Please provide all deliverable details, such as FTP/emails etc.; info in the ADDITIONAL INFO area below.")'> <option value="" selected="selected"></option> <option value="File Cargo" >File Cargo</option> <option value="FTP" >FTP</option> <option value="Email" >Email</option> <option value="Temp Folder" >Temp Folder</option> <option value="Disk" >Disk</option> </select> <label for="deliverable info">Deliverable Info</label> </div> </li> </li> <li id="li_13" > <label class="description" for="Additional">Additional Info</label> <div> <textarea id="Additional" name="Additional" class="element textarea medium"></textarea> </div> </li> </ul> <p> <label for="userCopyMe">Check the box if you wish to be sent a copy of this message</label> <br /> <input type="checkbox" name="userCopyMe" id="userCopyMe" value="1" <?php if ($userCopyMe == "1") { echo "checked=\"checked\""; }?> /> </p> <li class="buttons" id="saveForm"> <input type="reset" value="Reset" > <input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" onclick="verify();"> </li> </ul> </form> <div id="footer"></div> </div> <img id="bottom" src="bottom.png" alt=""> </body> <name="form_delivery" value="digest"/> </form> </html> Thanks in advance! EDIT: pinche code tags. what line of code should i add in order to be able to reply to the sender of contact form. right now its showing the last email created in the server. heres the code <?php $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/")); // Checkbox handling $field_1_opts = $_POST['field_1'][0].",". $_POST['field_1'][1]; mail("randy@reefsclub.com","Invitation - Form submission","Form data: rooms: $field_1_opts First Name: " . $_POST['fname'] . " Last Name: " . $_POST['lname'] . " Your Email: " . $_POST['email'] . " Phone Number: " . $_POST['pnumber'] . " Request your arrival date: " . $_POST['field_2'] . " Request your departure date: " . $_POST['field_3'] . " Please send me an ownership package: " . $_POST['field_4'] . " ",$headers); include ("confirm.html"); ?> I would like to send a copy of the mail contents to sender. The mail is sent to me but not the sender. Below is my code but not sure where the error in code is . Any help would be great Thanks
<?php
I'm using the php mail function and sending to Gmail accounts it shows "Unknown Sender" This is my header: Code: [Select] $headers = "From: XXXXX\r\nReply-To: XXXX@XXXXX.com"; $headers .= "\r\nContent-Type: text/html; charset='iso-8859-1' Content-Transfer-Encoding: 7bit"; I read somewhere that removing the "\r" would work but no luck... any help would be awesome I recently changed the PHP code where the submitter receives a receipt, Now they want the submitter to receive it with less fields than what the E-mail goes to.
For example the people who get the email from the submitter sees all the fields, but the submitter gets a receipt with different fields. I cannot seem to figure it out. Any help is appreciated. So I receive all this fields name,lastname,email,Phone,ReferredBy. But the submitter receives only these files name,lastname,ReferredBy
<?php // OPTIONS - PLEASE CONFIGURE THESE BEFORE USE! $yourEmail = "example1@email,example2@email.com"; // the email address you wish to receive these mails through $yourWebsite = "Application"; // the name of your website $thanksPage = ''; // URL to 'thanks for sending mail' page; leave empty to keep message on the same page $maxPoints = 4; // max points a person can hit before it refuses to submit - recommend 4 $requiredFields = "name,lastname,email,Phone,ReferredBy"; // names of the fields you'd like to be required as a minimum, separate each field with a comma $textlink ='<a href="confirmation.html">Click Here And Take The Next Step</a>.' ; // DO NOT EDIT BELOW HERE $error_msg = array(); $result = null; $requiredFields = explode(",", $requiredFields); function clean($data) { $data = trim(stripslashes(strip_tags($data))); return $data; } function isBot() { $bots = array("Indy", "Blaiz", "Java", "libwww-perl", "Python", "OutfoxBot", "User-Agent", "PycURL", "AlphaServer", "T8Abot", "Syntryx", "WinHttp", "WebBandit", "nicebot", "Teoma", "alexa", "froogle", "inktomi", "looksmart", "URL_Spider_SQL", "Firefly", "NationalDirectory", "Ask Jeeves", "TECNOSEEK", "InfoSeek", "WebFindBot", "girafabot", "crawler", "www.galaxy.com", "Googlebot", "Scooter", "Slurp", "appie", "FAST", "WebBug", "Spade", "ZyBorg", "rabaz"); foreach ($bots as $bot) if (stripos($_SERVER['HTTP_USER_AGENT'], $bot) !== false) return true; if (empty($_SERVER['HTTP_USER_AGENT']) || $_SERVER['HTTP_USER_AGENT'] == " ") return true; return false; } if ($_SERVER['REQUEST_METHOD'] == "POST") { if (isBot() !== false) $error_msg[] = "No bots please! UA reported as: ".$_SERVER['HTTP_USER_AGENT']; // lets check a few things - not enough to trigger an error on their own, but worth assigning a spam score.. // score quickly adds up therefore allowing genuine users with 'accidental' score through but cutting out real spam $points = (int)0; $badwords = array("adult"); foreach ($badwords as $word) if ( strpos(strtolower($_POST['comments']), $word) !== false || strpos(strtolower($_POST['name']), $word) !== false ) $points += 2; if (strpos($_POST['comments'], "http://") !== false || strpos($_POST['comments'], "www.") !== false) $points += 2; if (isset($_POST['nojs'])) $points += 1; if (preg_match("/(<.*>)/i", $_POST['comments'])) $points += 2; if (strlen($_POST['name']) < 3) $points += 1; if (strlen($_POST['comments']) < 15 || strlen($_POST['comments'] > 1500)) $points += 2; if (preg_match("/[bcdfghjklmnpqrstvwxyz]{7,}/i", $_POST['comments'])) $points += 1; // end score assignments foreach($requiredFields as $field) { trim($_POST[$field]); if (!isset($_POST[$field]) || empty($_POST[$field]) && array_pop($error_msg) != "Please fill in all the required fields and submit again.\r\n") $error_msg[] = "Please fill in all the required fields and submit again."; } if (!empty($_POST['name']) && !preg_match("/^[a-zA-Z-'\s]*$/", stripslashes($_POST['name']))) $error_msg[] = "The name field must not contain special characters.\r\n"; if (!empty($_POST['email']) && !preg_match('/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])(([a-z0-9-])*([a-z0-9]))+' . '(\.([a-z0-9])([-a-z0-9_-])?([a-z0-9])+)+$/i', strtolower($_POST['email']))) $error_msg[] = "That is not a valid e-mail address.\r\n"; if ($error_msg == NULL && $points <= $maxPoints) { $subject = "Payment"; $message = "New applicant: \n\n"; foreach ($_POST as $key => $val) { if (is_array($val)) { foreach ($val as $subval) { $message .= ucwords($key) . ": " . clean($subval) . "\r\n"; } } else { $message .= ucwords($key) . ": " . clean($val) . "\r\n"; } } $message .= "\r\n"; // this means reply to the sender with e-mail and subject. if (strstr($_SERVER['SERVER_SOFTWARE'], "Win")) { $headers = "From: {$_POST['email']}\r\n"; $headers .= "Bcc: $yourEmail\r\n"; $headers .= "Reply-To: {$_POST['email']}\r\n"; } else { $headers = "From: {$_POST['email']}\r\n"; $headers .= "Bcc: $yourEmail\r\n"; $headers .= "Reply-To: {$_POST['email']}\r\n"; } if (mail($_POST['email'],$subject,$message,$headers)) { if (!empty($thanksPage)) { header("Location: $thanksPage"); exit; } else { $result = 'Congratulations! We have received your application. IMPORTANT Click link below'; $disable = true; } } else { $error_msg[] = 'Your mail could not be sent this time. ['.$points.']'; } } else { if (empty($error_msg)) $error_msg[] = 'Your mail looks too much like spam, and could not be sent this time. ['.$points.']'; } } function get_data($var) { if (isset($_POST[$var])) echo htmlspecialchars($_POST[$var]); } ?> Hi all, I am wondering what the best way to do this is... Take GoDaddy for example, if your domain is about to expire you will get an automatic email. I am wanting to do something similar, If someone orders a Soap Dispenser, I want to send an email (if they accept to receiving emails on the order) each month asking/reminding them to top up on soap. I have been reading but cant find anything adequate, I have seen something about Cron Jobs, but never heard of this before, please could you point me in the right direction. Thanks in advance. Peter Whenever i send emails via SMTP the reciever recieved it with Name 'ROOT USER'... I want to know How to change it to my Name..... What should i do for that... And also what should i do if i want to embed an image in the message..... It would be great if you provide me some link for styling the SMTP mail... Thanx... pranshu.a.11@gmail.com hello, im running my page on a seperate server than my exchange server. how would i set the smtp server in the following: Code: [Select] <?php $to = "mike@domain.com"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "mike@domain.com"; $headers = "From: $from"; mail($to,$subject,$message,$headers); echo "Mail Sent."; ?> |