PHP - Accessing Imap Mail Imap_open() Problem
Hi,
I have a script that creates an email through cpanel, that part works. But i am getting error reading the email. Code: [Select] Warning: imap_open() [function.imap-open]: Couldn't open stream {mail.spamarchon.com:143} in /home/spamarch/public_html/index.php on line 71here is the code: Code: [Select] $mbox = imap_open("{mail.$edomain:143}", "$euser@$edomain", "$epass"); any idea Thanks Similar TutorialsI've got a snippet of code that accesses an email account using the the imap function. In my class file I can use 'sender' => $headerArr->sender[0]->mailbox . "@" . $headerArr->sender[0]->host, and it gives me the senders email address. However when I try to use 'reply_to' => $headerArr->reply_to[0]->mailbox. "@" .$headers->reply_to[0]->host, it does not give me the reply to address (which can be different when receiving e-mails from groups, forums, etc). Any help would be appreciated. Jess Hello to all out there! this is my first post,so my question may sound a bit simple. :] I am studying PHP and MySQL and I tried to make a mailing form based on a mysql database. My problem occured when I tried to use the PEAR mail object. Here is my code: // THE INCLUDED FILES require_once ("attach_file.php" ); require_once ("Mail.php" ); require_once ("Mail\mime.php" ); //THE VARIABLES TAKEN FROM THE HTML FORM OR JUST CREATED FOR THE CONSTRUCTION OF THE EMAIL $my_email = "something@gmail.com"; $email_subject = mysql_real_escape_string(trim( $_POST['email_subject']),$server_connect ); $email_body = mysql_real_escape_string(trim( $_POST['email_body'] ),$server_connect ); $attached_file = $destination ; // the $destination variable comes from the copy() function in attach_file.php $username = "the_username@gmail.com"; $password = "the_password"; $host = "smtp.gmail.com"; $attach = new Mail_mime(); $attach -> addAttachment($attached_file); $email_body = $attach->get(); $extraheaders = array('from'=>$my_email,'to'=>$email_etaireias,'subject'=>$email_subject,'Bcc'=>$email_etaireias); $headers = $attach -> $headers($extraheaders); // HERE GIVES ME AN ERROR!!! -->Fatal error: Method name must be a string $smtp_info = array('host'=>$host,'auth'=>TRUE,'username'=>$username,'password'=>$password); $smtp = Mail::factory('smtp',$smtp_info); //loop through every single line of the database until there are no more lines with data //and store each line in 3 different variables that i can use while ( $row = mysql_fetch_array($result) ) { $onoma_etaireias = $row['onoma_etaireias']; $email_etaireias = $row['email_etaireias']; $website_etaireias = $row['website_etaireias']; } //construct the mail function . The @ is supressing the errors created .remove it and they will be shown. $mail = @$smtp->send($email_etaireias,$headers,$email_body); As i searched here and there for a solution, i found that it has something to do with the way the mail-mime object creates the body of the email . I also tried to find a solution from the PEAR documentation. do i create the headers someway wrong????? This topic has been moved to Installation on Linux. http://www.phpfreaks.com/forums/index.php?topic=343589.0 Hi
I have the following code, which works fine.
How can I pull in any images attached to the email and display them under the echo $val ?
Thanks
$mbox = imap_open("{SERVER}", "user", "pass"); echo "<h1>Mailboxes</h1>\n"; $folders = imap_listmailbox($mbox, "{SERVER}", "*"); if ($folders == false) { echo "Call failed<br />\n"; } else { foreach ($folders as $val) { echo $val . "<br />\n"; } } echo "<h1>INBOX</h1>\n"; $headers = imap_headers($mbox); if ($headers == false) { echo "Call failed<br />\n"; } else { $i=0; foreach ($headers as $val) { $i++; echo $val . "<br />\n"; } } imap_close($mbox); Hi all, I am still trying to figure what went wrong. It doesn't work over here. The error shown was the {else} command else { echo '<p class="error">There was a problem accessing your profile.</p>'; } I have attached my 4 sql tables for reference. Appreciate any advices.... Code: [Select] <?php $query3 = "SELECT ols.subject_level_id, sl.level_id, sl.subject_id, tl.level_name AS level_name, ts.subject_name AS subject_name " . "FROM tutor_overall_level_subject AS ols " . "INNER JOIN tutor_subject_level AS sl USING (subject_level_id) " . "INNER JOIN tutor_level AS tl USING (level_id) " . "INNER JOIN tutor_subject AS ts USING (subject_id) " . "WHERE ols.tutor_id = '" . $_GET['tutor_id'] . "'"; $data3 = mysqli_query($dbc, $query3) or die(mysqli_error($dbc)); if (mysqli_num_rows($data3) == 1) { echo '<div id="panel4">'; echo'<table><tr>'; // Start your table outside the loop... and your first row $count = 0; // Start your counter while($row3 = mysqli_fetch_array($data3)) { /* Check to see whether or not this is a *new* row If it is, then end the previous and start the next and restart the counter. */ if ($count % 5 == 0) { echo "</tr><tr>"; $count = 0; } echo '<td class="label">' . $row3['level_name'] . '</td><td>' . $row3['subject_name'] . '</td>'; $count++; //Increment the count } echo '</tr></table><br/>'; //Close your last row and your table, outside the loop echo '</div>'; //End of panel 4 } //End of if (mysqli_num_rows($data3) == 1) else { echo '<p class="error">There was a problem accessing your profile.</p>'; } ?> I have a notification system that notifies users of new comments, inside the email I have images, some of the logo, some of different people, everything shows up fine on my computer (yahoo email), however in the iPhones email application no images show up, there are just the blue squares with the question marks in them. I'm not sure what I'm missing. Code: [Select] $from = "Kithell <notifications@kithell.com>"; $headers = "From:" . $from ."\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $subject = name($from_id, 'fl').$action; $message = '<html><body> <style>@charset "utf-8"; /* CSS Document */ .e-container { background-color: #FFF;position: relative;width: 90%;min-height:1px;margin-right: auto;margin-left: auto; } .e-container .e-m-header { padding: 2px; background-image: url(http://www.kithell.com/assets/tall-grey-header.png); background-repeat: repeat-x; border: 1px solid #CCC; background-position: bottom; display: block; text-align: center; } .e-container p { font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; color: #666; vertical-align: text-top; display: inline-block; } .e-container .e-usr-photo { display: inline-block; margin: 10px; float: left; background-color: #F4F4F4; } .e-container p a { font-weight: bold; color: #3F60A3; text-decoration: underline; padding: 0px; float: left; margin-top: 0px; margin-right: 5px; margin-bottom: 0px; margin-left: 0px; } .e-container .e-quotes { font-size: 20px; font-weight: bold; color: #999; font-family: Tahoma, Geneva, sans-serif; display: block; padding: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 75px; margin-top:10px; } .e-container .e-message { font-size: 13px; color: #333; padding: 0px; margin-top: 0px; margin-right: 10px; margin-bottom: 0px; margin-left: 10px; clear: none; display: inline; }</style> <div class="e-container"><div class="e-m-header"><img src="http://www.kithell.com/assets/kithell-logo.png" /></div><img class="e-usr-photo" src="http://www.kithell.com/'.photo($from_id, 55).'" /><br /><p><a target="_blank" href="http://www.kithell.com/#/profile&id='.$from_id.'">'.name($from_id, "fl").' </a> '.$action.'<div class="e-quotes">"<p class="e-message">'.nl2br(htmlentities(stripslashes($message))).'</p>"</div></p></div></body></html>'; mail($to,$subject,$message,$headers); This topic has been moved to Other Web Server Software. http://www.phpfreaks.com/forums/index.php?topic=347009.0 I have a basic mail script (with the standard mail function: mal() ) that I use for a confirmation email (in a users sign up form). The form and the mail is almost always successfully submitted. Although every once in a while, I get the following error : 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() BTW, the users input is succesfully inserted into the database; but he never recieves the confirmation mail.... i'm running php 5.3 in wamp server with windows xp sp3 <?php $Name = "my name"; //senders name $email = "mymail@gmail.com"; //senders e-mail adress $recipient = "some_mail@hotmail.com"; //recipient $mail_body = "The text for the mail..."; //mail body $subject = "Subject for reviever"; //subject $header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields ini_set('sendmail_from', 'mymail@gmail.com'); //Suggested by "Some Guy" ini_set('SMTP', 'smtp.gmail.com'); //Suggested by "Some Guy" ini_set('smtp_port', 465); //Suggested by "Some Guy" $result = mail($recipient, $subject, $mail_body, $header); //mail command return $result; ?> some one help me please I have this code in borrow.php Whenever they click the button 'sendMail' an email is sent to that user who tries to borrow that specific book (the book details are left out cuz we don't need them here) Code: [Select] <?php global $interface; global $user; if (isset($_POST['sendMail'])){ $to = $partner->email; $subject = "ILB Request"; if(!isset($user->id)){ $lastname = $_POST['lastname']; $firstname = $_POST['firstname']; $email = $_POST['email']; $telephone = $_POST['telephone']; $fax = $_POST['fax']; }else{ $lastname = $user->lastname; $firstname = $user->firstname; $email = $user->email; $telephone = $user->telephone; $fax = $user->fax; } $message = " <html> <body> <h2>Loaner Details</h2> <table> <tr> <td>Name: </td> <td>" . $lastname . "</td> </tr> <tr> <td>First Name: </td> <td>" . $firstname . "</td> </tr> <tr> <td>Email: </td> <td>" . $email . "</td> </tr> <tr> <td>Telephone: </td> <td>" . $telephone . "</td> </tr> <tr> <td>Fax: </td> <td>" . $fax . "</td> </tr> </table> </body> </html> "; // Always set content-type when sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; // More headers if(!isset($user->id)){ $headers .= 'From: <' . $_POST['email'] . '>' . "\r\n"; }else{ $headers .= 'From: <' . $user->email . '>' . "\r\n"; } if(!empty($email)){ if(mail($to,$subject,$message,$headers)){ $interface->assign('success', "Your IBL request has been sent succesfully!"); }else{ $interface->assign('success', "Your IBL request has failed!"); } }else{ $interface->assign('success', "Email address has to be filled in!"); } } And then there is this code in Edit.php: Whenever a person changes someone elses profile (like an admin), the person whos profile is being changed needs to be notified by email. It's the same function as before though it gives this error: "Warning: 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:\vufind\web\services\MyResearch\Edit.php on line 182" But the php.ini file hasn't been changed, and it doesn't give error the the previous code above (+ I receive the email) So I add to the file below: Code: [Select] <?php ini_set("SMTP","mySMTPserver."); ini_set("smtp_port","25"); ?> and now i get this msg... "Warning: mail(): SMTP server response: 503 5.5.2 Need Rcpt command." Code: [Select] <?php global $interface; global $user; if (isset($_POST['submit'])) { if(isset($_GET['userID'])){ $updateUser = new User(); if($user->id != $_GET['userID']){ $to = $updateUser->email; $subject = "Profile has been changed by " . $user->firstname . " " . $user->lastname; $message = " <html> <body> <h2>Notification</h2> <br /><br /> Hi, <br /><br /> This is an email notification you receive when your profile has been changed! </body> </html>"; // Always set content-type when sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; // More headers $headers .= 'From: admin@felnet.be' . "\r\n"; echo $to . " " . $subject . " " . $message . " " . $headers; if(mail($to,$subject,$message,$headers)){ $interface->assign('sent', "Success!"); }else{ $interface->assign('sent', "Fail!"); } } I really need help with this I have a php script that queries the database and then sends a separate email but I was just recently told they would like each query to to be put in an email so we only send one like the way i made it below (sorry if it's sloppy) if anyone can help I would greatly appreciate it. Thanks in advance ___________________________________ Name | Date | Address | State | _______|_____|______________|______ | John | 3/18 | 215 5th Street | NY | ______ |____ |______________|______ | Bob | 4/15 | 505 North Street | NY | ______ |____ |_____________ |______ | Jane | 5/9 | 6 main Street | MD | ______ |____|_______________ | ______| Ann | 1/12 | 9 West Ave | CA | ______ |____ |_______________|______ | I am trying to get the PHP mail function to work. I am using a WAMP server and php.ini is set to: [mail function] ; For Win32 only. SMTP = localhost smtp_port = 25 ; For Win32 only. ;sendmail_from = ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ;sendmail_path = ; Force the addition of the specified parameters to be passed as extra parameters ; to the sendmail binary. These parameters will always replace the value of ; the 5th parameter to mail(), even in safe mode. ;mail.force_extra_parameters = My PHP script looks like this: <php? $to = "djbouch@comcast.net"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "djbouch@comcast.net"; $headers = "From:" . $from; mail($to,$subject,$message,$headers); echo "Mail Sent."; ?> For some reason the mail won't send and I am getting the following message: 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() Thanks for your help with this. Daniel Hello! Dear all, I'm having this problem with PHP Mail From Name, it took me entire day, and still haven't figure out the issue...that is... In "From: ", if I have it in simple email format, such as "From: name@server.com" it works...but when I have it with a From Name, eg. "From: Name <name@server.com>", then it just wouldn't send... I heard that some of the servers just won't parse "Name <name@server.com>", if it is the case...would there be any work around to get that From Name appeared? The code is attached below, any help is deeply appreciated! <?php //For Captcha include("settings.php"); header("Content-Type: text/html; charset=utf-8"); @session_start(); $string = strtoupper($_SESSION['string']); $userstring = strtoupper($_POST['userstring']); @session_destroy(); if (($string != $userstring) || (strlen($string) <= 4)) { header("location:contact_us.php"); exit(); } //PHP Mail starts here $form_name = $_POST["name"]; $form_company = $_POST["company"]; $form_email = $_POST["email"]; $form_phone = $_POST["phone"]; $form_mobile = $_POST["mobile"]; $form_msg = $_POST["msg"]; $form_date = date(Y)."-".date(m)."-".date(d); $form_ip = $_SERVER["REMOTE_ADDR"]; $form_lang = "en"; $fromname = "Name"; $frommail = "name@server.com"; @require("../default_timezone.php"); $con = mysql_connect("host","user","pass"); mysql_query("SET NAMES 'utf8'"); if (!$con) { die("Could not connect: " . mysql_error()); } mysql_select_db("dbname", $con); mysql_query("INSERT INTO tablename (CU_Name, CU_Company, CU_Email, CU_Tel, CU_Mobile, CU_Content, CU_CreateDate, CU_IP, lang) VALUES ('$form_name', '$form_company', '$form_email', '$form_phone', '$form_mobile', '$form_msg', '$form_date', '$form_ip', '$form_lang')"); $message = (" <table width=\"500\" border=\"0\" cellspacing=\"0\" cellpadding=\"5\"> <tr> <td colspan=\"2\" align=\"left\"><img src=\"contact_logo.gif\" /></td> </tr> <tr> <td colspan=\"2\" align=\"left\"><font style=\"font-size: 12px; color: #000;\">Your email is recceived, a representative will be contacting you soon.</font></td> </tr> <tr> <td width=\"70\" align=\"left\"><font style=\"font-size: 12px; color: #000;\"><b>Name:</b></font></td> <td width=\"430\" align=\"left\"><font style=\"font-size: 12px; color: #000;\">{$form_name}</font></td> </tr> <tr> <td align=\"left\"><font style=\"font-size: 12px; color: #000;\"><b>Company:</b></font></td> <td align=\"left\"><font style=\"font-size: 12px; color: #000;\">{$form_company}</font></td> </tr> <tr> <td align=\"left\"><font style=\"font-size: 12px; color: #000;\"><b>Email:</b></font></td> <td align=\"left\"><font style=\"font-size: 12px; color: #000;\">{$form_email}</font></td> </tr> <tr> <td align=\"left\"><font style=\"font-size: 12px; color: #000;\"><b>Phone:</b></font></td> <td align=\"left\"><font style=\"font-size: 12px; color: #000;\">{$form_phone}</font></td> </tr> <tr> <td align=\"left\"><font style=\"font-size: 12px; color: #000;\"><b>Mobile:</b></font></td> <td align=\"left\"><font style=\"font-size: 12px; color: #000;\">{$form_mobile}</font></td> </tr> <tr> <td align=\"left\" valign=\"top\"><font style=\"font-size: 12px; color: #000;\"><b>Message:</b></font></td> <td align=\"left\" valign=\"top\"><font style=\"font-size: 12px; color: #000;\">{$form_msg}</font></td> </tr> </table> "); $subject = "Email Subject"; $mime_boundary = md5(uniqid(mt_rand(), TRUE)); $header = "From: ".$fromname." <".$frommail.">\r\n"; $header.= "To: " . $to . "\r\n"; $header.= "MIME-Version: 1.0\r\n"; $header.= "Content-Type: multipart/mixed; \r\n"; $header.= " boundary=". $mime_boundary . "\r\n"; $content = "This is a multi-part message in MIME format.\r\n"; $content .= "--" . $mime_boundary . "\r\n"; $content .= "Content-Type: text/html; charset=utf-8\r\n"; $content .= "Content-Transfer-Encoding: 8bit\r\n\r\n"; $content .= $message. "\r\n"; $to=$form_email; @mail($to, $subject, $content, $header); $to2="my@server.com"; @mail($to2, $subject, $content, $header); echo "<html>"; echo "<head>"; echo "<META HTTP-EQUIV='Content-Type' content='text/html; charset=utf-8'>"; echo "<META HTTP-EQUIV='Refresh' CONTENT='3; URL=http://www.server.com/'>"; echo "</head>"; echo "<body>"; echo "Thank you for contacting us!"; echo "<br />"; echo "Your message is sent."; echo "</body>"; echo "</html>"; ?> How do u work with .jpg file attachments using the IMAP mail functions... i already know how to read the body text from an e-mail with IMAP but I haven't worked with attachments and don't know where to start... i basically want to get the .jpg attachment and save it to a folder on my server. Hey guys, Been developing a bespoke "helpdesk" system for work and, while it works well on the whole, I am having major problems with base64 encoded email bodies. Admittedly, this might be due to my misunderstanding of imap body parts. It seems in my current setup, the system thinks that all mails are either "type" 0 or 4. As a result, base64 emails don't get decoded and display as an unreadable long string. Here is what my code for the body decoding looks like just now - can provide more on request. $from=$overview[0]->from; $subject=$overview[0]->subject; $subdb=mysql_real_escape_string($subject); $lookingfor=explode("~#",$body); $result=$from; $find=strrpos($ir, $lookingfor[1]); $findreplystream=mysql_query("SELECT * FROM tickets WHERE ticket_md5='$lookingfor[1]'") or die(''.mysql_error().''); $stream=mysql_fetch_array($findreplystream); $now=time(); if($structure->encoding == 0){ $arr1=array("=A3", "=80"); $arr2=array("£", "€"); $newcontent=$explodeunder[0]; define("CHARSET", "ISO-8859-1"); $dbcontenta=str_replace($arr1, $arr2, $newcontent); $r=mb_detect_encoding($dbcontenta); if($r=="UTF-8"){ $dbcontents=mb_convert_encoding($dbcontenta, "ISO-8859-1", "UTF-8"); $dbcontent1=addslashes($dbcontents); $dbcontent2=strip_tags($dbcontent1); } elseif($r=="ASCII"){ $dbcontentb=mb_convert_encoding($dbcontenta, "UTF-8", "ASCII"); $dbcontents=mb_convert_encoding($dbcontentb, "ISO-8859-1", "UTF-8"); $dbcontent1=addslashes($dbcontents); $dbcontentf=strip_tags($dbcontent1); $dbcontent2=quoted_printable_decode($dbcontentf); } } elseif($structure->encoding == 4) { $dbcontent=$explodeunder[0]; $dbcontentf=quoted_printable_decode($dbcontent); $dbcontent2=mb_convert_encoding($dbcontentf, "ISO-8859-1", "UTF-8"); } elseif($structure->encoding == 3) { $dbcontent2=imap_base64($explodeunder[0]); } elseif($structure->encoding == 1){ $dbcontent3=imap_8bit($explodeunder[0]); $dbcontent2=quoted_printable_decode($dbcontent3); } Can anyone advise me with this? I'd be greatful for any assistance at all, as it's causing me nightmares! All the best The imap code below displays the date like this: Sat, 18 Feb 2012 19:22:02 +0100 I want the date to be displayed like this instead: 2012-02-18 Any idea how I can achieve this? Thanks in advance Code: [Select] <?php date_default_timezone_set ("Europe/Stockholm"); /* connect to mail */ $hostname = '{xxx.xxxx.com:143/notls}INBOX'; $username = 'xxxxx@xxxxx.com'; $password = 'xxxxxx'; /* try to connect */ $inbox = imap_open($hostname,$username,$password) or die('Anslutning till mail misslyckades: ' . imap_last_error()); /* grab emails */ $emails = imap_search($inbox,'ALL'); /* if emails are returned, cycle through each... */ if($emails) { /* begin output var */ $output = ''; /* put the newest emails on top */ rsort($emails); /* for every email... */ foreach($emails as $email_number) { /* get information specific to this email */ $overview = imap_fetch_overview($inbox,$email_number,0); $message = imap_fetchbody($inbox,$email_number,2); $date = date('d m Y'); $swedate = $overview[0]->date; /* output the email information */ $output.= '<li>'; $output.= '<a href="#"><strong>'.$swedate.'</strong> '; $output.= ''.$overview[0]->subject.'<br> '; $output.= '<small> Från: '.$overview[0]->from.'</small></a>'; $output.= '</li>'; } echo $output; } /* close the connection */ imap_close($inbox); ?> I'm using imap_open and when I use imap_headerinfo and output the info, I want to be able to have an array of words to match the fromaddress to.... case-insensitive. I tried ton of different ways... array_search array_filter stripos stristr And tried adding strtolower in a few Tried setting the object as a var and comparing it that way... but it either chokes on the object or the array... Or ignores it completely For example setting an array like this: Code: [Select] $blacklist_array = array("wl_partners@cupid.com", "Replica Shop", "CJ Adams", "eharmony", "Dr.Maxman", "Credit Check"); And the fromaddress has this in it: Credit Check <check@iamaspammer.com> I can't get it to work to match the Credit Check only part. I got it to work if I do a foreach through the messages and then a foreach through the array then process a good or bad result, but it takes too long if there are a ton of messages to process... The code is a mess right now with all the trial and errors. Any ideas? I'm kinda brain dead at this point and have been up way to long... Thanks... Problem with this header. $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "From: $to\r\n" . "Reply-To: $email\r\n" . "X-Mailer: PHP/" . phpversion(); $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $body = "<html><body>".$table."</body></html>"; Can anyone tell me why? Hello all, I have a contact form which has a drop-down-menu (the reason why a user is using the form). I am wanting the option which has been selected to appear in the PHP scripted email as the subject. I am just sat here staring at the code and getting nowhere with it. Could anyone help me? HTML form Code: [Select] <form name="contact_form" method="post" action="mail.php" onsubmit="return validate_form();"> <p>Full Name <em>(required)</em>:<br /> <input class="tb-focus" type="text" name="name" id="name" size="40" value="" /></p> <p>Reason for Contact:<br /> <select class="select"> <option value="CV">CV Request</option> <option value="enquiry">General Enquiry</option> <option value="request">Request for Audition</option> </select> <p>Email Address <em>(required)</em>:<br /> <input class="tb-focus" type="text" name="email" id="email" size="40" value="" /></p> <p>Agency Name <em>(if applicable)</em>:<br /> <input class="tb-focus" type="text" name="business" id="business" size="40" value="" /></p> <p>Contact Number <em>(required)</em>:<br /> <input class="tb-focus" type="text" name="number" id="number" size="40" value="" /></p> <p>Message <em>(required)</em>:<br /> <textarea class="tb-focus" name="message" id="message" rows="6" cols="40"></textarea></p> <p><input class="button" type="submit" value="Submit Form" /></p> </form> PHP email POST: Code: [Select] <?php // Assign the posted values as variables to use later $name = $_POST['name']; $email = $_POST['email']; $reason = $_POST['sdsdsd']; $business = $_POST['business']; $number = $_POST['number']; $message = $_POST['message']; $to = "*********"; $subject = "Email Contact Form - " . $_POST[name]; $message = "Filled out contact form on portfolio website.\n \n Full Name: " . $_POST[name] . "\n Email: " . $_POST[email] . "\n Business Name: " . $_POST[business] . "\n Contact Number: " . $_POST[number] . "\n Message: " . $_POST[message]; //leave the next 2 lines alone $headers .= "MIME-Version: 1.0rn"; $headers .= "Content-Type: text/html; charset=ISO-8859-1rn"; if (empty($name) || empty($email) || empty($number) || empty($message)) { echo "<p>You appear to not have filled in the necessary fields.</p>"; echo "<p>Please click <a href='contact.html'>here</a> to re-enter your information.</p>"; } elseif(!mail($to, $subject, $message, $headers)){ echo "Sorry, there has been an error! Please try sending your message again. Click <a href='contact.htm'>here</a> to start again."; } else { echo "Thank you for taking the time to fill out the contact form. I will get back to you as soon as I can."; } ?> I have absolutely no idea where to start with this. Thanks in advance for the help |