mark103 Posted January 28, 2011 Share Posted January 28, 2011 Hi guys, I am writing the php script to send the email. I have noticed when I picked up on my email, I can see that it have been covered with mailed-by: myservername.com. I want to hide it, but I can't find a way to get it resolve. Here's the code: <?php session_start(); define('DB_HOST', 'localhost'); define('DB_USER', 'myusername'); define('DB_PASSWORD', 'mypass'); define('DB_DATABASE', 'mydbname'); $errmsg_arr = array(); $errflag = false; $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } function clean($var){ return mysql_real_escape_string(strip_tags($var)); } $name = clean($_GET['name']); $email = clean($_GET['email']); $type = clean($_GET['type']); $comments = clean($_GET['comments']); if($name == ''){ $errmsg_arr[] = 'name are missing.'; $errflag = true; } elseif($email == ''){ $errmsg_arr[] = 'email are missing.'; $errflag = true; } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; echo implode('<br />',$errmsg_arr); } else { $insert = array(); if(isset($_GET['name'])) { $insert[] = 'name = \'' . clean($_GET['name']) .'\''; } if(isset($_GET['email'])) { $insert[] = 'email = \'' . clean($_GET['email']) . '\''; } if(isset($_GET['type'])) { $insert[] = 'type = \'' . clean($_GET['type']) . '\''; } if(isset($_GET['comments'])) { $insert[] = 'comments = \'' . clean($_GET['comments']) . '\''; } if (count($insert)>0) { $names = implode(',',$insert); if(isset($email)){ $name = $_GET['name']; $email = $_GET['email']; $header = "From: $name <$email>". "\r\n"; $to = "[email protected]"; $subject = $type; $message = "$comments & $rate"; $header .= "MIME-Version: 1.0\l\n"; $add = "<$email>"; mail($to, $subject, $message, $header, $add); echo "Thank you for sent us your email"; } } } ?> I guess that something got to do with this: if(isset($email)){ $header = "From: $name <$email>". "\r\n"; $header .= "MIME-Version: 1.0\l\n"; $add = "<$email>"; } I have disabled the safe-mode, so do you know how I can hide the mailed-by header using with the code on above?? Any advice would be much appreciate. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/225972-send-email-script/ Share on other sites More sharing options...
l4nc3r Posted January 28, 2011 Share Posted January 28, 2011 If it's a header why don't you just set it in the additional_headers parameter of the mail function? Quote Link to comment https://forums.phpfreaks.com/topic/225972-send-email-script/#findComment-1166692 Share on other sites More sharing options...
mark103 Posted January 29, 2011 Author Share Posted January 29, 2011 yeah i did, so thanks for your help. However, how I can send the email for the clients to receive the email within 48 hours? Quote Link to comment https://forums.phpfreaks.com/topic/225972-send-email-script/#findComment-1166834 Share on other sites More sharing options...
mark103 Posted January 29, 2011 Author Share Posted January 29, 2011 do anyone know how to do this? Quote Link to comment https://forums.phpfreaks.com/topic/225972-send-email-script/#findComment-1166949 Share on other sites More sharing options...
BlueSkyIS Posted January 29, 2011 Share Posted January 29, 2011 do you want the email to NOT be sent UNTIL AFTER 48 hours? You'd use a cron job. if you mean "make sure the email is sent within 48 hours", it will probably be sent within seconds or minutes. Quote Link to comment https://forums.phpfreaks.com/topic/225972-send-email-script/#findComment-1167026 Share on other sites More sharing options...
nankoweap Posted January 29, 2011 Share Posted January 29, 2011 yeah i did, so thanks for your help. However, how I can send the email for the clients to receive the email within 48 hours? once the email leaves your application, it's subject to the whims of the ether. typically, most email is delivered within seconds, but it can take longer depending upon content, routing, polling interval of the destination client, etc. if your emails aren't delivered within 48 hours, it's likely an issue with the receiving SMTP server and/or the account on that server. Quote Link to comment https://forums.phpfreaks.com/topic/225972-send-email-script/#findComment-1167110 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.