forsakenmemory Posted October 12, 2007 Share Posted October 12, 2007 simple question on sending email attachments via a contact form on a website. although because it's for clients i need one of those "browse..." buttons that allows you to search for the file on your computer and then uploads it to the server before sending... if that makes sence. i've looked and tried a couple of net tutorials but they seem pretty usless, maybe i'm going about it wrong can any one help please! thanks... here's the code i already have to attach it to.... <?php $EmailFrom = Trim(stripslashes($_REQUEST['EmailFrom'])); $EmailTo = "admin@webdesigndigital.com"; $Subject = Trim(stripslashes($_REQUEST['Subject'])); $Name = Trim(stripslashes($_REQUEST['Name'])); $Tel = Trim(stripslashes($_REQUEST['Tel'])); $Website = Trim(stripslashes($_REQUEST['Website'])); $Enquiry = Trim(stripslashes($_REQUEST['Enquiry'])); function checkEmail($EmailFrom) { if(eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]", $EmailFrom)) { return FALSE; } list($Username, $Domain) = split("@",$EmailFrom); if(getmxrr($Domain, $MXHost)) { return TRUE; } else { if(fsockopen($Domain, 25, $errno, $errstr, 30)) { return TRUE; } else { return FALSE; } } } if (Trim($EmailFrom)=="") { print "You did not enter an email address! Please try again"; exit; } if(checkEmail($EmailFrom) == FALSE) { print "The email address you entered was not valid. please try again"; exit; } if (Trim($Name)=="") { print "You did not enter a Name. Please try again."; exit; } if (Trim($Enquiry)=="") { print "You did not enter an enquiry. Please go back and try again."; exit; } $Body = ""; $Body .= "Name: " . $Name . "\n" . "\n"; $Body .= "Tel: " . $Tel . "\n" . "\n"; $Body .= "Website: " . $Website . "\n" . "\n"; $Body .= "Enquiry: " . $Enquiry . "\n"; $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">"; } else{ print "The was an error! Please go back and try again."; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/72926-sending-email-attachments/ Share on other sites More sharing options...
forsakenmemory Posted October 12, 2007 Author Share Posted October 12, 2007 bump Quote Link to comment https://forums.phpfreaks.com/topic/72926-sending-email-attachments/#findComment-367810 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.