Query on email message via dreamweaver mail form

Hello All,
First time I've done a mail form so not sure if this is what is supposed to happen. When an email is received via the mail form it has 'submit submit' at the bottom of the message and I'd like to get rid of it if poss.
The code is:
<div id="form"><form id="contactform" name="contactform" method="post" action="FormToEmail.php">
      <label>Your Name:<br />
<input name="name" type="text" id="name" />
<br />
</label>
  <br />
  <label>Your Email Address:<br />
<input name="email" type="text" id="email" />
  </label>
  <br />
  <br />
  <label>Your Message:<br />
<textarea name="message" cols="50" rows="10" id="message"></textarea>
  </label>
  <br />
  <br />
  <input type="submit" name="Submit" value="Submit" />
And the php is:
$errors = array();
// Remove $_COOKIE elements from $_REQUEST.
if(count($_COOKIE)){foreach(array_keys($_COOKIE) as $value){unset($_REQUEST[$value]);}}
// Check all fields for an email header.
function recursive_array_check_header($element_value)
global $set;
if(!is_array($element_value)){if(preg_match("/(%0A|%0D|\n+|\r+)(content-type:|to:|cc:|bcc: )/i",$element_value)){$set = 1;}}
else
foreach($element_value as $value){if($set){break;} recursive_array_check_header($value);}
recursive_array_check_header($_REQUEST);
if($set){$errors[] = "You cannot send an email header";}
unset($set);
// Validate email field.
if(isset($_REQUEST['email']) && !empty($_REQUEST['email']))
if(preg_match("/(%0A|%0D|\n+|\r+|:)/i",$_REQUEST['email'])){$errors[] = "Email address may not contain a new line or a colon";}
$_REQUEST['email'] = trim($_REQUEST['email']);
if(substr_count($_REQUEST['email'],"@") != 1 || stristr($_REQUEST['email']," ")){$errors[] = "Email address is invalid";}else{$exploded_email = explode("@",$_REQUEST['email']);if(empty($exploded_email[0]) || strlen($exploded_email[0]) > 64 || empty($exploded_email[1])){$errors[] = "Email address is invalid";}else{if(substr_count($exploded_email[1],".") == 0){$errors[] = "Email address is invalid";}else{$exploded_domain = explode(".",$exploded_email[1]);if(in_array("",$exploded_domain)){$errors[] = "Email address is invalid";}else{foreach($exploded_domain as $value){if(strlen($value) > 63 || !preg_match('/^[a-z0-9-]+$/i',$value)){$errors[] = "Email address is invalid"; break;}}}}}}
// Check referrer is from same site.
if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){$errors[] = "You must enable referrer logging to use the form";}
// Check for a blank form.
function recursive_array_check_blank($element_value)
global $set;
if(!is_array($element_value)){if(!empty($element_value)){$set = 1;}}
else
foreach($element_value as $value){if($set){break;} recursive_array_check_blank($value);}
recursive_array_check_blank($_REQUEST);
if(!$set){$errors[] = "You cannot send a blank form";}
unset($set);
// Display any errors and exit if errors exist.
if(count($errors)){foreach($errors as $value){print "$value<br>";} exit;}
if(!defined("PHP_EOL")){define("PHP_EOL", strtoupper(substr(PHP_OS,0,3) == "WIN") ? "\r\n" : "\n");}
// Build message.
function build_message($request_input){if(!isset($message_output)){$message_output ="";}if(!is_array($request_input)){$message_output = $request_input;}else{foreach($request_input as $key => $value){if(!empty($value)){if(!is_numeric($key)){$message_output .= str_replace("_"," ",ucfirst($key)).": ".build_message($value).PHP_EOL.PHP_EOL;}else{$message_output .= build_message($value).", ";}}}}return rtrim($message_output,", ");}
$message = build_message($_REQUEST);
$message = $message . PHP_EOL.PHP_EOL."-- ".PHP_EOL."";
$message = stripslashes($message);
$subject = "TOP FLOOR WEBSITE ENQUIRY";
$headers = "From: " . $_REQUEST['email'];
mail($my_email,$subject,$message,$headers);
?>
Thanks alot in advance

Wow. Not much defeats legibilty quite as well as avoiding line feeds and indention in recursive code! (and inserting multiple blank lines? Was that this online editor?)
Anyway, I did not test this, but try replacing your build_message function,
function build_message($request_input){if(!isset($message_output)){$message_output ="";}if(!is_array($request_input)){$message_output = $request_input;}else{foreach($request_input as $key => $value){if(!empty($value)){if(!is_numeric($key)){$message_output .= str_replace("_"," ",ucfirst($key)).": ".build_message($value).PHP_EOL.PHP_EOL;}else{$message_output .= build_message($value).", ";}}}}return rtrim($message_output,", ");}
With this:
function build_message($request_input) {
  if(!isset($message_output)) {
    $message_output ="";
  if(!is_array($request_input)) {
    $message_output = $request_input;
  else{
    foreach($request_input as $key => $value) {
      if(!empty($value)) {
        if(!is_numeric($key)) {
          $message_output .= str_replace("_"," ",ucfirst($key)).": ".build_message($value).PHP_EOL.PHP_EOL;
        else {
          if ($key != strtolower('submit') {
            $message_output .= build_message($value).", ";
  return rtrim($message_output,", ");
(Added condition for 'submit')
Also, I highly recommend replacing all those $_REQUEST with $_POST or $_GET, whichever is appropriate for your form.
Mark A. Boyd
Keep-On-Learnin' :-)
If you are reading this via email, be aware that it may not be an accurate representation of my message. Login to read the actual message and/or to reply.

Similar Messages

  • How Do highlight text in the body of an email message in Mac Mail?

    Can anyone tell if IF and HOW I can highlight text in the body of an email message using Mac Mail (in Yosemite).  I do NOT mean MARKUP an attachment.  I want to highlight a word or phrase in the body of my email message.  I know I can change the font color, but can't seem to add a highlight!  Thanks!

    Hi,
    is is possible, - link is below. Works on Yosemite, btw.
    http://www.mihalick.us/how-to-highlight-text-in-yellow-using-apple-mail/

  • Setting Importance Level for a email message using javax.mail.* API

    Setting Importance Level for a email message using javax.mail.* API
    From what I understand we can set Flag on Email Message. How can we set Importance Leve: High/Low for an email message?
    Thanks
    Purvi

    Most of the message Flags work only for IMAP mailboxes. POP3 supports only the DELETED flag. It must be understood that Javamail is a framework which provides all the features available in a standard mailing system. But whether or not a particular feature works is a functionality of the particular implementation being used.
    Thus for example POP3 cannot differentiate read from unread messages in a mailbox though Javamail provides that feature.

  • How to send error message via a mail to the customers email id

    HI experts ,
    i have a requirement,In idoc where i have to send the error message via email to a perticular emailid?
    please help me n tell also which fm is used for that?
    Thanks
    RAhul Sisodia

    Hi ,
    Check this Link..
    [sending an email with multiple attachments;
    Regards,
    Sachin M M

  • Submit by Email - won't e-mail form

    After clicking the button, a window pops up with three choices, I select "Desktop Email Application". After I click "ok", "send data file", send e-mail message, the following error message appears:
    The connection to the server has failed. Account: 'xxx.net', Server: 'xxx.net', Protocol: SMTP, Port: 25, Secure(SSL): No, Socket Error: 10061, Error Number: 0x800CCC0E
    How can I fix the connection? I didn't find anything in preferences or the tutorial to help me figure out what is wrong.
    Thanks for your time!
    Hayley

    Server name and firewall verified seem okay.
    I wonder whether the problem may have to do with the program trying to send the xml message via Mirosoft Outlook. The company is using a program called FirstClass to send e-mail, which is connected to a server they refer to as "InterAct". Are you familiar with this type of server? Is there a way to connect to an e-mail format other than Outlook in Designer?

  • HARD CODED EMAIL MESSAGES FROM AN ORACLE FORM

    I have SMTP code in a WHEN-BUTTON-PRESSED TRIGGER which will preformat the recipient line, the courtesy copy line, the subject line, and a hard coded email message and then send the email to another co-worker inhouse in our organization whenever a user would press a button on an ORACLE FORM.
    Would this same code be useful if the user wanted to send an email to another user in another organization millions of miles away? Do I have to be concerned about how the email system is set up in the other organization and code the program specifically for that particular organization? Here is the code that I am using.
    PROCEDURE SEND_INFO
    Sender varchar2 := :SUPPLY_REQUEST.NAME,
    Recipient varchar2 := :SUPPLY_REQUEST.SENDNAME,
    Recipient4 varchar2 := :SUPPLY_REQUEST.OTHNAME4,
    Ccrecipient varchar2 := ' ',
    Subject varchar2 := 'TODAY IS ANOTHER DAY OF YOUR LIFE',
    Message varchar2 := 'IS THIS IS A GOOD DAY ?'
    ) IS
    crlf Varchar2(2) := CHR(13)||CHR(10);
    connection utl_smtp.connection;
    Mailhost Varchar2(30) := 'erecemh1-bh.erec.army.mil';
    header VARCHAR2(1000);
    BEGIN
    connection := utl_SMTP.open_connection(mailhost);
    header := 'Date: '||TO_CHAR(NEW_TIME(SYSDATE,'EST','GMT'),'fm DD MON YY HH24:MI:SS AM')||crlf||
    'From: '||sender||' '||crlf||
    'To: '||recipient||','||recipient4||crlf||
    'CC: '||ccrecipient||crlf||
    'Subject: '||subject;
    utl_SMTP.helo(connection, mailhost);
    utl_SMTP.mail(connection, sender);
    utl_SMTP.rcpt(connection, recipient);
    utl_SMTP.rcpt(connection, recipient4);
    utl_SMTP.open_data(connection);
    utl_SMTP.write_data(connection, header||crlf);
    utl_SMTP.write_data(connection, crlf ||message|| crlf);
    utl_SMTP.close_data(connection);
    utl_SMTP.quit(connection);
    EXCEPTION
    WHEN UTL_SMTP.INVALID_OPERATION THEN
    DBMS_OUTPUT.PUT_LINE('INVALID OPERATION IN SMTP TRANSACTION.');
    WHEN UTL_SMTP.TRANSIENT_ERROR THEN
    DBMS_OUTPUT.PUT_LINE('tEMPORARY PROBLEMS WITH SENDING EMAIL - TRY AGAIN LATER.');
    WHEN UTL_SMTP.PERMANENT_ERROR THEN
    DBMS_OUTPUT.PUT_LINE('ERRORS IN CODE FOR SMTP TRANSACTION');
    END;
    In another step of the program, I have initialized the variables:
    SUPPLY_REQUEST.NAME to '[email protected]'
    SUPPLY_REQUEST.OTHNAME4 to '[email protected]'
    SUPPLY_REQUEST.SENDNAME to '[email protected]'

    Would this same code be useful if the user wanted to send an email to another user in another organization millions of miles away?
    Depends on your mail server. If your mail server allows email to be sent out of your organization, then yes, you can email to another organization millions of miles away (or further).
    Do I have to be concerned about how the email system is set up in the other organization
    Generally, no. However they can set up their system to block emails coming from a certain address.
    and code the program specifically for that particular organization?
    Nope, just make sure you have their correct email address.

  • How to email reports via SMTP server FORMS AND REPORTS 6i and databse 8i

    Dear All,
    through reports builder reports are build but i need to email reports via SMTP server is it possible in 6i are not?if yes the how please rep asap

    If it will be a scheduled report, you can create a batch file to run report with reqd parameters and generate it's pdf in a oracle directory.
    Then schedule the batch file on oracle database pc, (thru task scheduler if OS is windows),
    Then a email procedure will be required which will pick up the pdf from oracle directory, attach it and send mail.
    Even the email procedure can be scheduled thru oracle job, but the OS batch schedule time and Oracle Job time should be handled as some gap will be needed between the two.
    As for the email smtp procedure with attachments, you can find one in this forum or try googling it.
    Regards,
    Amol

  • Blank incoming email messages - only in Mail

    There's some email lists that I subscribe to, with automated earthquake and volcano information, and recently the emails are blank, when I view them using Mac Mail. However, if I check my email with a browser, I can see the content of the message. If I look at these emails in Mail with the Raw Source, they are still blank. Does anybody know what is up? Someone thought perhaps a newer version of Mail is pickier about html. I've not found anyone else with the same problem in my office, and I don't see a mention of it on the discussion boards.
    Cheers, Peter

    First off, view the Long Header details (from Mail, choose View > Message > Long Headers; from MobileMe Mail, the gearbox button (list of actions) > Preferences > Viewing > Enable "Show Long Headers"). This exposes a whole lot of heretofore invisible data.
    Making sense of it is another issue, but I think I may have found something (from a Mac user, to boot) that seems to hit the nail right on the head.
    Robert Vaessen has a very extensive, scholarly post, dated January of this year, about this very issue on his site at <http://www.robsworld.org/blankemail.html>. The post is detailed, technical, and certainly worth reading for anyone who is concerned enough to have sought out this discussion thread. But to cut to the chase, here is his conclusion:
    +"It is my opinion, (based upon more than ten years worth of fighting spam, ten years of running web sites, and extensive research) that these blank emails (in my experience), and millions like them are part of a growing spam problem. These blank email messages represent part of a spammers whitelisting effort. Responses which generate bounce messages permit the spammer to refine his/her recipient list, while the ones that get delivered are marked as valid addressees. These lists are then used by the spammer in his/her own campaign, sold to other spammers, or both."+
    He recommends (and provides some how to's for) reporting the emails back up the food chain as the best thing we can do to help cauterize the bleeding. What I'm wondering now is if we can somehow (SpamSieve, maybe?) set our Macs to bounce anything from the offending servers, so that our address becomes 'dead' to them.
    I'm also pursuing this with MobileMe support—it seems that everything to do with MobileMe is now being handled outside of AppleCare, and the only path is online chatting with them. I'm also curious as to why my MobileMe account seems to be the only place these are surfacing; i.e., are my other accounts' servers already bouncing such messages, or am I just not seeing them? If I get anything helpful from MobileMe, I'll post it here.

  • How do i get email messages back into mail

    hi,
    i recently deleted some email accounts that i no longer use but forgot to save the email messages first. i managed to locate the emails on a backup that i made. i now have lots of .emix files, each of which if i double click them open up so i can read the email, but i cannot find a way of getting them all back into Mail so i can search etc. ideally i want to create a new folder in Mail called Old Mail and get all my .emix files into that folder, but whenever I try and drag and drop them into the folder Mail won't do anything. I don't want to just restore the backup as I have since received emails in Mail from my other accounts, and don't want to lose anything. Any ideas what I need to do?

    Hi
    Use the "Import Mailboxes" function in Mail > File menu and follow the instructions
    Mail Help - enter "Import" has some info as well
    chris

  • I opened my google email account via the MAIL icon and cannot close it or sign out. Can anyone advise how to do this?

    How can I close my google email account which I opened via the MAIL icon ?

    Just close the Mail app or not, doesn't really matter.
    I have a couple of google email accounts in the iPads Mail and the same ones open in the Mac's mail app. I do sign out after using web mail though.. That doesn't have any effect on the iPad or Mac mail apps.

  • Where are my email messages from the Mail app located in Lion?

    I copied all my email messages from my PowerMac with OS X 10.5 and want to copy them to my MacBook with OS X 10.7, but I can't find the folder in Lion where email messages are stored for the Mail application. Where have they been moved to? I have been using 10.5 for a long time and am not aware of changes like this to the new OS.

    They are in your Library folder, but it is now hidden in Lion. You can unhide it by either:
    hold Option key and to to Go Menu in Finder - Library will be there. Once open you can drag its' icon into the Sidebar if you want.
    Or, you can use this terminal command:
    chflags nohidden ~/Library
    Once in the Library, there is the Mail folder. Please note that they are now in a folder named "V2" and the format is not compatible with Snow Leopard. You can try putting your folders there, but I do not know if that will work, especially since they are from 10.5.

  • How can I always display duplicate email messages in Apple Mail?

    I would like to have Apple Mail ALWAYS display "duplicate" messages without having to click on the duplicates link in the upper right of the message. 
    Apple Mail identified a series of messages as "duplicates" when in fact they were not duplicates.  I would have otherwise missed out on very important information and the only reason I even knew to look for this was because I saw them on my iPhone.  I want to avoid this issue in the future.

    Comfortable with terminal...know how to edit using TextEdit:
    Open up a Terminal and use the following commands to change your Mail.app preferences file to an XML format – the default format is binary, and you can't edit this.
    cd ~/Library/Preferences
    plutil -convert xml1 com.apple.mail.plist
    Then, open this file com.apple.mail.plist with a text editor of your choice, preferably one that highlights XML syntax, but you can also use TextEdit:
    open -a "TextEdit" com.apple.mail.plist
    Now, look for the key called MailAccounts. It's value is an array, with dict children. Here, you'll find all your mail accounts in the order they were created in.
    You can now manually move these dict children around. Save the XML file and reopen Mail. Now, your Mail account order will be changed.

  • Blank Email Messages Sent from Mail to Some Recipients!

    When I send email, using Apple Mail, I'm told that the body of my messages appear completely blank (although my address and the subject line do come through). I've narrowed it down to people who have hotmail, msn, and earthlink accounts.
    I have tried on both my MacBook Pro and older G4. They both have this problem. I also have 4 email accounts, all through different services, and again all have this problem.
    I am using some CSS in my signatures, but when I don't use a signature I still have this problem.
    Any ideas on what the issue might me. Thanks in advance.

    Hi ideaspring
    I compared your plist to mine. There were many differences naturally, but some stand out in my opinion:
    I found the following in your plist, but no in mine:
    EncryptOutgoingMessages = 1;
    I'm not sure, what this is, but I believe you might have installed a .Mac certificate and set you .Mac account to use this certificate to encrypt or just sign your messages.
    I played with that some time ago: the problem was: windows mail clients had to go through quite a hassle to verify my cert, while Mail.app users were fine.
    I found the following in my plist, but not in yours.
    SendFormat = Plain;
    SendWindowsFriendlyAttachments = 1;
    AttachAtEnd = 1;
    The first can be set in Preferences > Composing, the second and third via the Edit Menu > Attachments > Always...
    It would be helpful, if you could narrow the problem down to one of your mailboxes and one recipient, who is willing to help you testing. Even if it happens to all your mailboxes and some recipients, it would be good, if we could find a way of always reproducing the symptom.
    Hth,
    --greg

  • Cannot read email message body in Mail

    Hello Pholks,
    I'm running iBook G4 w/ OS 10.4.8. Upon starting my computer and Mail this morning, I have the following very strange problem - similar to one other who has posted today:
    I can see messages in my Inbox. I can see sender, subject, date sent, etc...
    However, when I highlight the message, the only thing that appears in the message windo is the header info (From: Subject: Date: To:) The body of the message is not visible. This is true for some of the messages in my Inbox, but not all. Some are old, some are new today.
    Further: I also see this behavior in my archived messages. Picking a random mailbox on my hard drive, some message bodies are visible, others not. It appears to be random; I can't find any common link between the messages that aren't visible.
    Further: If I use Entourage, I don't have this problem; that is, the message bodies that aren't visible in Mail are visible in Entourage.
    Further: If I go onto my hard drive to the Inbox folder and select a .mbox folder and look at the messages, some have visible bodies, some not.
    This appears to be a problem specific to Mail. Please help - many of my archived emails are no longer accessible to me.
    Further: I've done two things that may have played a role. (1) I downloaded and installed software updates for iChat and the new Security update last night; (2) I've just added an external HD for backup. I tried to run a simple backup script last night, which resulted in the iBook HD chugging for quite some time, but never did put the data on the external HD. I've run "Repair Permissions" in Disk Utility, but to no avail.
    HELP.....

    Thanks very much. It's turned out to be a font problem. About 30 of the fonts in my account directory /users/me/library/fonts folder were corrupted. They were somehow being viewed as unix executable files instead of font suitcases. !??! No idea what happened there.
    I used Pacifist to reload fonts from my OSX installation disc, but this didn't seem to help. Instead, I found other copies of most of the corrupted fonts in the microsoft office/office/fonts folder, and replaced the corrupted fonts in my home library w/ those.
    I was alerted to the fact the the problem was fonts when I tried to open an Excel file; it came back with messages that these various fonts were corrupted and needed to be removed. Strangely, though the corrupted fonts were in my home directory font folder and not the MS Office font folder, Excel was tripping up - i.e., it wasn't using the fonts from the Office folder. Hmm.
    Finally, there are still a few fonts that are corrupted, and whose source is a mystery to me. They didn't come from the OS installation disc and they don't come from Office; consequently, I can't fix them. They are: Geneva CE, Geneva CY, GrCourier and N Helvitica Narrow.
    Does anyone know where these fonts come from?

  • Archiving Older Email Messages in Apple Mail

    Hi,
    I have searched here and the Internet, but I can't find an answer.
    I am using OS X 10.8.2 and Mail 6.2. I have emails dating back to 2008. I want to clear out my Inbox so, I was hoping that I could archive my old emails, but still have them available (or easily restore-able) should I need them.
    I created smart mailboxes by year, 2008, 2009, etc. I was hoping that I could archive each smart mailbox and then delete the emails from my Inbox. However, it doesn't look like Mail will allow me to do that. I tried right-clicking the smart mailbox, but there is no archive option. If I highlight the smart mailbox the 'Archive' option under the Message Menu is grayed out.
    There must be a way that I can accomplish archiving in Apple Mail.
    Any suggestions?
    Thanks!
    Paul

    If you're not using IMAP, Mail is still communicating with the mail server, so even if you see those types of messages, nothing abnormal is going on. There's no such thing as invisible email, so if there were really anything being sent or downloaded, you'd see it.
    Mulder

Maybe you are looking for

  • Color management detective needed!

    I need help with some color management issues I'm having. I've noticed that RAW images imported into Aperture (both 1.0.1 and 1.1) look very different than those imported into PS2 via ACR. I've been told that this is simply a result of the different

  • Difficulty creating rich text fields with autoresizing text on my mac (Mavericks?)

    I'm a new user so I could be making a simple error, but here goes: I'm trying to make the text fields in a pdf form be rich text with the font autoresizing as needed, but these setting seem not to save when I do this on my new mac desktop. When I ope

  • Empty mp3 file

    when I download; some mp3 files do not have a preview in the info window. the file indicates the size, but there is no audio. thanks in advance

  • Firefox says it is running but doesn't show up anywhere that it is?

    I tried to start firefox (the newest version) in safe mode, but I accidentaly pushed the restart button instead of the start in safe mode button. After that, a loading bar appeared, and then we lost power before it could do whatever it was doing. Aft

  • MacBook desktop not responding

    I am unable to select anything on the MacBook desktop. The mouse is not frozen but clicking it does nothing. I think user accounts got changed somehow. How do I fix this without losing files? Thanks.