www.webdeveloper.com
Results 1 to 14 of 14

Thread: My message is sent as spam

Hybrid View

  1. #1
    Join Date
    Apr 2011
    Location
    Nairobi
    Posts
    14

    My message is sent as spam

    I have a contact form in my website, using the php below to delivery the form result as email.

    PHP Code:
    <?php
    if(!isset($_POST['send']))
    {
        
    //Need to submit the form.
        
    echo "error; you need to submit the form!";
    }
    $name $_POST['name'];
    $visitor_email $_POST['email'];
    $message $_POST['message'];

    //Validate first.
    if(empty($name)||empty($visitor_email)) 
    {
        echo 
    "Your Name and Email is required, please try again!";
        exit;
    }

    if(
    IsInjected($visitor_email))
    {
        echo 
    "Bad email value!";
        exit;
    }

    $email_from 'silas@sicdesigns.info';//<== this websites email, I shall update this when we get the domain name.
    $email_subject "New Form Submission SiC";
    $email_body "You have received a new quick message from $name.\n\n".
        
    "Here is the message:\n
        From: 
    $visitor_email\n\n
        
    $message\n\n".
        
    $to "sicdesigz@gmail.com";//<== where it will send the message to, let me use my email for now.
    $headers "From: $email_from \r\n";
    $headers .= "Reply-To: $visitor_email \r\n";
    //Send the email!
    mail($to,$email_subject,$email_body,$headers);
    //done. redirect to thank-you page.
    header('Location: thank-you.html');


    // Function to validate against any email injection attempts
    function IsInjected($str)
    {
      
    $injections = array('(\n+)',
                  
    '(\r+)',
                  
    '(\t+)',
                  
    '(%0A+)',
                  
    '(%0D+)',
                  
    '(%08+)',
                  
    '(%09+)'
                  
    );
      
    $inject join('|'$injections);
      
    $inject "/$inject/i";
      if(
    preg_match($inject,$str))
        {
        return 
    true;
      }
      else
        {
        return 
    false;
      }
    }
       
    ?>
    My problem is that whenever someone uses the contact form, I receive the email as spam, instead of the normal inbox folder. Could the problem be in the php above?

  2. #2
    Join Date
    Oct 2009
    Posts
    32
    The mail provider classify the mails!
    So i don't think you have something to change in your code
    Just happens

  3. #3
    Join Date
    Mar 2011
    Location
    Ponca City, OK
    Posts
    42
    This means that your server has been identified as an origin of spam at gMail. Probably due to emails being reported as spam coming from the same server as your website.

  4. #4
    Join Date
    Apr 2011
    Location
    Nairobi
    Posts
    14
    If so, does it mean that I cannot do anything else rather than moving to a different server?
    I am thinking of using the 'not spam' option to move the message to inbox, but I don't believe this is a professional way of doing it...
    Could there be any other alternative?

  5. #5
    Join Date
    Apr 2011
    Posts
    13
    can you share your received mail with all the details?
    must include this info:
    from, to & mailed-by

  6. #6
    Join Date
    Apr 2011
    Location
    Nairobi
    Posts
    14
    This is one of my received messages that ended up in the spam folder...
    from silas@sicdesigns.info
    reply-to debali@yahoo.com
    to sicdesignz@gmail.com
    date Thur, Apr 08, 2011 at 12:56 AM
    subject New Form Submission
    mailed-by srv20.**********.com



    You have received a new quick message from Alicia Debra.

    Here is the message:

    From: emailremoved@yahoo.com

    Subject: Personal Website

    Message:I am a model and I need a personal website, 4-6 pages, simple and stylish.
    My budget for the website is a bit low, let me know how much you normally charge for such a website.

    Kind regards,
    Alicia Debra

    sicdesignz@gmail.com

  7. #7
    Join Date
    Apr 2011
    Location
    Nairobi
    Posts
    14
    Mailed-by is censored. I cant find a way of avoiding it: Lets try this; 0 0 0 web host with no spaces is the censored part in the above mailed-by.
    Last edited by Sic Laskie; 04-15-2011 at 09:18 AM.

  8. #8
    Join Date
    Jan 2007
    Location
    Wisconsin
    Posts
    2,120
    In gmail, click the down arrow and then show original. Let's see some headers ... I'm guessing we'll see an SPF failure -- and possibly a blacklisted IP.

  9. #9
    Join Date
    Apr 2011
    Location
    Nairobi
    Posts
    14
    And here are the headers...
    Delivered-To: sicdesignz@gmail.com
    Received: by 10.142.199.16 with SMTP id w16cs222325wff;
    Thur, 08 Apr 2011 05:56:38 -0700 (PDT)
    Received: by 10.229.106.83 with SMTP id w19mr1448910qco.186.1302872197778;
    Thur, 08 Apr 2011 05:56:37 -0700 (PDT)
    Return-Path: <a5208997@srv20.**********.com>
    Received: from srv20.**********.com (srv20.**********.com [64.191.56.21])
    by mx.google.com with ESMTPS id e17si5530660qck.54.2011.04.15.05.56.36
    (version=TLSv1/SSLv3 cipher=OTHER);
    Thur, 08 Apr 2011 05:56:36 -0700 (PDT)
    Received-SPF: pass (google.com: best guess record for domain of a5208997@srv20.**********.com designates 64.191.56.21 as permitted sender) client-ip=64.191.56.21;
    Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of a5208997@srv20.**********.com designates 64.191.56.21 as permitted sender) smtp.mail=a5208997@srv20.**********.com
    Received: from a5208997 by srv20.**********.com with local (Exim 4.69)
    (envelope-from <a5208997@srv20.**********.com>)
    id 1QAiZa-0006VP-6M
    for sicdesignz@gmail.com; Thur, 08 Apr 2011 08:56:30 -0400
    To: sicdesignz@gmail.com
    Subject: New Form Submission
    X-PHP-Script: sicdesigns.info/php/main_contact.php for 62.24.114.250
    From: silas@sicdesigns.info
    Reply-To: debali@yahoo.com
    Message-Id: <E1QAiZa-0006VP-6M@srv20.**********.com>
    Date: Thur, 08 Apr 2011 08:56:30 -0400
    X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
    X-AntiAbuse: Primary Hostname - srv20.**********.com
    X-AntiAbuse: Original Domain - gmail.com
    X-AntiAbuse: Originator/Caller UID/GID - [5208997 5208997] / [47 12]
    X-AntiAbuse: Sender Address Domain - srv20.**********.com


    You have received a new full message from Alicia Debra.

    Here is the message:

    From: debali@yahoo.com

    Subject: Personal Website

    Message:I am a model and I need a personal website, 4-6 pages, simple and stylish.
    My budget for the website is a bit low, let me know how much you normally charge for such a website.

    Kind regards,
    Alicia Debra

    sicdesignz@gmail.com
    ...I can see lots of 'X-AntiAbuse' which I guess its where we can identifies the problem, now the next step will be?

  10. #10
    Join Date
    Jan 2007
    Location
    Wisconsin
    Posts
    2,120
    If I'm not mistaken, those abuse headers are there to link the email back to your hosting account if someone complains about you. More concerning to me are the masked hostnames. Have you masked them? Or is that simply how they appear in the original headers?

    I could also see some issue with the From address being different than the Return-Path address -- especially since they're in an entirely different domain.

    You can also lower your spam score a little by adding a name to your From address:

    From: "sic designs" <silas@sicdesigns.info>

    instead of

    From: silas@sicdesigns.info

    Also note, your SPF records designate only google servers as permitted senders for your domain. You could actually use this to your advantage and send your mail via those servers.

  11. #11
    Join Date
    Apr 2011
    Location
    Nairobi
    Posts
    14
    My host server name is automatically masked by this forum, it is suppose to be 0 0 0 web host with no spaces.
    I am changing the from part and let y'll know the results in a while.
    Thanks so much, I believe that will help....
    I have looked at your website and it is nice.
    Thanks for checkin out my site, it actually one of my first websites, am beginning a career as a freelance graphic and web designer.

  12. #12
    Join Date
    Jan 2006
    Location
    MN
    Posts
    440
    Possibly the fact that you have;

    From: silas@sicdesigns.info
    Reply-To: debali@yahoo.com

    With the from and reply-to as different addresses, it might trip a spam detection. I think you do that so you can just reply to the email directly from your email, but maybe that is what is causing the problem.

    I have looked at your website and it is nice.

  13. #13
    Join Date
    Apr 2011
    Location
    Nairobi
    Posts
    14
    Still not working...
    I have tried changing "From" to the visitor's email but it doesn't solve the problem at all. I even tried changing it to the return path (a5208997@srv20.**********.com) but the messages are still caught in junk mail folder!

  14. #14
    Join Date
    Jan 2006
    Location
    MN
    Posts
    440
    I don't think changing the From to = the visitors email will work since spam catchers can determine that that is false.

    When you say it goes into the junk mail folder -- do you mean in your email client (e.g. outlook, outlook express, or thunderbird) or do you mean at a web based email site like mail.google.com -- can't you declare the email to be not junk?

    Change the reply-to to your own email address. You already have the email address of the visitor in the body of the email, you can click on that to actually reply to the email if you want too.

    The new email could even append the contents of the email by doing something like;


    Here is the message:
    PHP Code:

    $visitorEmail 
    "mailto:debali@yahoo.com";
    $subject urlencode("Personal Website");
    $message urlencode("I am a model and I need a personal website, 4-6 pages, simple and stylish.
    My budget for the website is a bit low, let me know how much you normally charge for such a website.

    Kind regards,
    Alicia Debra"
    );

    echo 
    "From: <a href='"$visitorEmail "?subject=" $subject "&amp;body=" $message ."'>" $visitorEmail ."</a>"
    Unfortunately that puts a lot of + signs in the message body, but it keeps the other formatting better.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles