PHP - Spam Emails
Hi This subject doesn't really have a category but is driving me mad. I use the mail() function to send out emails to a news group forum that I have created. This forum does the same. I am getting the emails placed in a spam folder. Is there any way around this. I have been told that it has something to do with no reverse DNS. I get emails like DoNotReply@bt.com. This email address doesn't exist. How does the email system know this, and is there a way around it.
TIA Desmond. Similar TutorialsHi.. I want to implement a program for identifying spam emails using an algorithm naive bayes in php.. How to implement this ..can any one help me.. thanks in advance Hello, recently I changed host of my website and when a visitor clicks "contact us" button in my website (in which one needs to enter his/ her email, name, phone , etc) and submit his/her message then I get email. Before this hosting I used to get emails from the visitor who filled the form so it was easier for me to reply but now after I changed the host I get email as "mydomain@hosting-company-domain" instead of the visitor's email. I messaged them then they told me something about SMTP authenticate using PHP, please guide me to fix this. ive been geting attacked by a spam bot it is inserting gibrish in one of my contact forms. i managed to block it with Code: [Select] if (empty($_POST['Email']) && !empty($_POST['CustomerEmail'])) Email is an empty text field with display:none for sometime it was clean and now it succeeds once in a while to insert a form. i dont want to use captcha , i think i will loose clients your advise I 'm having some problem while sending mails . i am sending bulk mails using php script, der is no problem in the script. i hope some guys have faced similar issue. while i am sending bulk emails, i figured out that - few mails are going to spam not into their INBOX. can you guys pls give some hint to resolve this issue. .. Hey My site is getting alot of spam and i need a way to keep up with what is being sent with some kinda system that will flag things which contain urls and chosen keywords. Problem i faced though was lets say a keyword was: skyspider Now some one could say sky or spider (as seperate words) but they still flagged. So "theres a spider in the sky" would be flagged when i only want "skyspider" flagged... does that make sense? What php function do i require to do such string checks like this? Thanks A form is filled and the information is emailed to my address. The problem is it goes to the spam folder. Is it a problem with the email filter? I suppose I could whitelist the email address the server uses to email the info, but then spam would get through as well. Any ideas? Hi; I had an email from my hosting company which said that my account was hacked and one script in images folder is trying to send thousands of spams(file name : "/public_html/images/sm5vy7.php"). they blocked my account and asked me to check if there is any script or code that may cause this problem. The only server side page I had was a contact.php file that has mail() function in it. the code is like this; "if( isset($_POST['submit'])) { $name=$_POST['name']; $comment=$_POST['comment']; $email=$_POST['email']; $phone=$_POST['phone']; $to = "sample@gmail.com"; $subject = "sample"; $message = "sample"; $from = "$email"; $headers = "Content-type:text;charset=utf-8" . "\r\n"; $headers .= "From: $from" . "\r\n"; mail($to,$subject,$message,$headers); }" My question is "can the code I used cause any security problem that someone be able to create a php file in my images folder or someone has accessed my account?" Thank you in advance I'm really in a big trouble i am using mail functions in php and i am sending mails but the mails are going to spam in gmail and for yahoo its going to inbox. my problem is i want to send the email to inbox only as most of them use gmail ....should i use any smtp or any other mail library functions? can anyone guide me? i got the below code from google, need to adapt it to use, it works, but i just need it to over write on the file instead of appending to the file , please help, i am not a coder nor understand much of this, if someone could change it for me please: function logText($text) { $ts = date("D d-m-y h:i A",time()); $toLog = "[" . $ts . "] " . $text; $fh = fopen("logFile.txt", 'a'); fwrite($fh, $toLog."\n"); fclose($fh); }Edited December 13, 2020 by requinix This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=354848.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=320638.0 Ok, so I want to make a comment spam filter for my site. I know the basic logic, but have yet to figure out how to write the functions. I have a database table called comments that has a column called "time", which contains a unix timestamp value of when it was posted. Basically what I want to do is this: When a user tries to post a comment, the script determines with a database query if they have posted a comment in the last 120 seconds. So basically I have to find the current time, and the time it was 120 seconds before the current time. Then I have to find any comments posted by the user that were made after the 120 second mark. My database query should then look something like this, right? Code: [Select] $query = mysql_query("SELECT * FROM comments WHERE author = ".$_SESSION['id']." AND time > '".$120secondsago"'"); Please correct me if my logic is wrong, which it very well may be, but how would I find the unix timestamp code from 120 seconds before the current time? Note that 120 seconds is just an example and also that I have not worked with dates in mysql very often. $query = mysql_query("SELECT * FROM comments WHERE author = ".$_SESSION['id']." AND time The script below works but it goes straight to the junk folder only since i added the parts below to the form. (the form is in another file) How do i stop it from going to the junk folder. Quote $error = $_GET['error']; $httpagent = getenv ('HTTP_USER_AGENT'); $url = $_SERVER['HTTP_REFERER']; Code: [Select] <?php require_once "Mail.php"; $optional = $_POST['optional']; $error = $_POST['error']; $url = $_POST['url']; $httpagent = $_POST['browser']; $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''; $from = "Web server <removed>"; $to = "Admin <removed>"; $subject = "Someone has submitted an error."; $body = "Someone has submitted an error.\n". "Error: $error\n". "URL: $url\n". "Web browser: $httpagent\n". "Anything else you want to add?: $optional\n". "IP: $ip\n"; $host = "removed"; $username = "removed"; $password = "removed"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo("<p>" . $mail->getMessage() . "</p>"); } else { header('Location: thank-you.html'); } ?> im having some robots injecting gibberish i wnat to deny amy links in the requesttext of the form for some reason i tested it and it accepted a http link Code: [Select] if (preg_match("/http/i","$RequestText")){ exit();} thanks Guys: I'm implementing a form for user submission. At the end of the form, there is an image that displays some randomly generated code. The user will be required to enter the code shown on this image before he clicks the submit button. This is done to protect the form from spamming, automatic submission. After the submit button is clicked, I need to do this: if ($_POST['the code the user enters'] == the code on the image) { // proceed(); } Any idea on how to get the code displayed on the image ? Thanks. HI, i have a problem, a big one. I used a php script to send some info from my html forms to my gmail. So it functions easy, somebody fills out the form and he click send, after that, his information is sent to me on my gmail, and i can work with it later. Now stupid google have some new filters (from year 2014 ) and it treats some of those mails as spam. Code is written in the way that allows me to get those mails as it is sent from the user himself, from his email. Can anybody correct my script so it won't be treated as a spam, because i know it is possible but don't know how... here is the code - https://gist.github....67145d500c5cf47 // Receiving variables
Below is my contact from - and I have set anti spam question as I don't like captcha. How to I code the post/human bit so it is case insensitive?
<div class="one-half-column-right" id="contactform"> <form method="post" action="index.php#contactform"> <label>Name*</label> <div class="clear"></div> <input name="name" placeholder="Type Here"> <label>Email*</label> <div class="clear"></div> <input name="email" type="email" placeholder="Type Here"> <label>Message</label> <textarea name="message" placeholder="Type Here"></textarea> <label>*If today is Tuesday, what is tomorrow? <br> [lowercase answer please]<br> (Anti-spam)</label> <input name="human" placeholder="Type Here"> <input id="submit" name="submit" type="submit" value="Submit"> </form> <?php $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $from = 'From: Website Form'; $to = ‘name@name.com’; $subject = 'website form enquiry'; $human = $_POST['human']; $headers .= 'From: '.$from."\r\n". 'Reply-To: '.$from."\r\n" . 'X-Mailer: PHP/' . phpversion(); $body = "From: $name\n E-Mail: $email\n Message:\n $message"; if ($_POST['submit'] && $human == ‘wednesday’) { if (mail ($to, $subject, $body, $from)) { echo '<p style="font-family: Montserrat, Helvetica, Arial, sans-serif; font-weight: 600; text-align:center; font-size: 16px; color: #000; text-transform: uppercase; background-color: #FFD700"> Request has been sent. We will get back to within 48 hours!<br></p>'; } else { echo '<p style="font-family: Montserrat, Helvetica, Arial, sans-serif; font-weight: 600; text-align:center; font-size: 16px; color: #000; text-transform: uppercase; background-color: #FFD700"> Something went wrong, go back and try again!</p>'; } } else if ($_POST['submit'] && $human != '') { echo '<p style="font-family: Montserrat, Helvetica, Arial, sans-serif; font-weight: 600; text-align:center; font-size: 16px; color: #000; text-transform: uppercase; background-color: #FFD700"> You answered the anti-spam question incorrectly!</p>'; } ?> <!--// form //-->
Hello there! I made a contact-form with PHP but the e-mails go directly into the spam folder. Then I ran a test on http://www.mail-tester.com and I got some errors. As you can tell, I am new to PHP and I don't know what to do. I appreciate any help! Errors: 1. HTML_MIME_NO_HTML_TAG HTML-only message, but there is no HTML tag 2. MIME_HTML_ONLY Message only has text/html MIME parts 3. MISSING_DATE Missing Date: header 4. "Your message is not signed by DKIM" 5. "There is no SPF record. Please add (number).easyname.com to your DNS zone file."
Here is my PHP: <?php $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $from = 'From: mywebsite.com'; $to = 'someone@something.net'; $subject = 'Subject-line'; $body = "From: $name\n E-Mail: $email\n Message:\n $message"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html\r\n"; $headers .= 'From: '. $email. "\r\n" . $headers .= "Reply-To: ". $email. "\r\n"; $headers .= "X-Mailer: PHP/" . phpversion(); $message = nl2br($message); $status = mail($to, $subject, $message, $headers); if($status) { echo '<p>Your Message has been send!</p>'; } else { echo '<p>Something went wrong. Please try again.</p>'; } ?> Here is my HTML: <div class="contact-form"> <form id="contact-form" method="post" action="contact-form-handler.php"> <input name="name" type="text" class="form-control" placeholder="Your Name" required> <br> <input name="email" type="email" class="form-control" placeholder="Your Email"> <br> <textarea name="message" class="form-control" placeholder="Message" rows="40" required></textarea><br> <input type="submit" class="form-control" value="SEND MESSAGE"> </form> </div>
I tried many things but nothing really worked. Also, I am a noob at PHP so I am kind of lost. Thanks for your help! I have a simple contact form I did a while ago for a small company. They emailed me saying they are getting bits of spam mail from the site occasionally and would like to get it stopped if possible. This is how my form looks: Code: [Select] <form method="post" action="mailer.php"> <div class="form_left"> <p>Name:<br> <input type="text" name="name" size="24" autofocus="true" placeholder="Type Here" required="true" /></p> </div> <div class="form_right"> <p>Email:<br> <input type="email" name="email" size="24" placeholder="Type Here" required="true" /></p> </div> <div class="form_left"> <p>Company Name:<br /> <input type="text" name="company" size="24" placeholder="Type Here" required="true" /></p> </div> <div class="form_right"> <p>Phone Number:<br /> <input type="text" name="phone" size="24" placeholder="Type Here" required="true" /></p> </div> <div class="form_left"> <p>Your Message:<br /> <textarea rows="6" name="message" cols="55" placeholder="Type Here" ></textarea></p> </div> <p class="submit"><input type="submit" value="Send Mail" name="submit" /></p> </form> Code: [Select] <?php if(isset($_POST['submit'])) { // $to = "mail@mydomain.com"; $to = "mail@mydomain.com"; $subject = "Web Enquiry"; $name = $_POST['name']; $email = $_POST['email']; $company = $_POST['company']; $phone = $_POST['phone']; $message = $_POST['message']; if (strlen(trim($message)) > 0) { $body = "From: $name \n\n Email: $email \n \n Company: $company \n\n Phone Number: $phone \n\n Message: $message"; if (mail($to, $subject, $body)) { echo "<h3>Thanks! Your email has been sent <br />We will answer your enquiry as soon as possible.</h3>"; } else { echo 'Cannot sent mail'; } } else { echo "<h3>Error! <br />Please ensure that all fields are filled out correctly in order to email us.</h3>"; } } ?> Any help or pointers as to how I could add in a little security would be appreciated. Hey, I have a downloaded theme which appears to have hidden spam link in the footer somewhere, but I'm having a hard time locating the source. Here is the site: www.yourvancouvermortgagebroker.ca At the very bottom of the source, you can see: Code: [Select] <script type='text/javascript' src='http://www.yourvancouvermortgagebroker.ca/wp-content/plugins/contact-form-7/jquery.form.js?ver=2.47'></script> <script type='text/javascript' src='http://www.yourvancouvermortgagebroker.ca/wp-content/plugins/contact-form-7/scripts.js?ver=2.4.2'></script> <a href ="http://wp2blog.com"><img src="http://www.yourvancouvermortgagebroker.ca/wp-content/themes/Minimal/images/blank.gif" height="1" width="1" /></a> </body> </html> I've tried de-activating the plugins and it's still there (so it's not a plugin). I've also changed themes and it disappears, so it's only this theme. Here is functions.php: Code: [Select] <?php require_once(TEMPLATEPATH . '/epanel/custom_functions.php'); require_once(TEMPLATEPATH . '/includes/functions/comments.php'); require_once(TEMPLATEPATH . '/includes/functions/sidebars.php'); load_theme_textdomain('Minimal',get_template_directory().'/lang'); require_once(TEMPLATEPATH . '/epanel/options_minimal.php'); require_once(TEMPLATEPATH . '/epanel/core_functions.php'); require_once(TEMPLATEPATH . '/epanel/post_thumbnails_minimal.php'); $wp_ver = substr($GLOBALS['wp_version'],0,3); if ($wp_ver >= 2.8) include(TEMPLATEPATH . '/includes/widgets.php'); ?> and footer.php: Code: [Select] <div id="footer" > <div id="footer-content"> <ul id="bottom-menu"> <?php global $is_footer, $page_menu, $category_menu; $is_footer = true; elegant_init(); if (get_option('minimal_home_link') == 'on') { ?> <li <?php if (is_front_page()) echo('class="current_page_item"') ?>><a href="<?php bloginfo('url'); ?>"><?php _e('Home','Minimal'); ?></a></li> <?php }; ?> <?php if ($category_menu <> '<li>No categories</li>') echo($category_menu); ?> <?php echo $page_menu; ?> </ul> <!-- end ul#bottom-menu --> </div> <!-- end #footer-content --> </div> <!-- end #footer --> </div> <!-- end #page-wrap --> <?php include(TEMPLATEPATH . '/includes/scripts.php'); ?> <?php wp_footer(); ?> </body> </html> Where should I look from here? The link switches every once and a while if that's relevant. I've tried a full text search of all the files for the actual link and it never shows up. Thanks |