SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Oct 2006
    Location
    Syracuse, NY
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Email issues (caught as spam)

    Hey everyone, this following PHP script I'm using along with Swiftmailer is being caught as Spam on the mail server it's being sent to. The reason its being caught as spam, is because the header information is "malformed", or so my web host tells me. If anyone sees something that would cause this in the code, please let me know. Thanks.

    PHP Code:
    $subject "Website: News Story needs review/activation.";
    $message "There has been a news item submitted for review";
                
    require_once 
    "lib/Swift.php";
    require_once 
    "lib/Swift/Connection/SMTP.php";
    require_once 
    "lib/Swift/Authenticator/LOGIN.php";
                
    $conn =& new Swift_Connection_SMTP("mail.midstatemutual.com");
    $conn->attachAuthenticator(new Swift_Authenticator_LOGIN());
    $conn->setUsername("gregj@midstatemutual.com");
    $conn->setPassword("password");
    $swift =& new Swift($conn);
                
    $message =& new Swift_Message("$subject""$message");
                
    if (
    $swift->send($message"gregj@midstatemutual.com""gregj@midstatemutual.com")) echo "Sent"
    else echo 
    "Failed"

  2. #2
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I think it's something to do with swiftmailer itself, not your code.

    I can't find anything on google, so I hope someone can help you.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2007
    Location
    edge of nowhere
    Posts
    74
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Make sure you have a valid From and Reply-To address and no unusual other headers, for starters. Run your script from a different host and see what you get as well.
    Programming boils down to three things: fast, good and cheap.
    Please pick two.

  4. #4
    SitePoint Wizard Hammer65's Avatar
    Join Date
    Nov 2004
    Location
    Lincoln Nebraska
    Posts
    1,161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If it is saying that the headers are malformed then look at the raw message and see if you can determine what specifically might be wrong. If you don't see anything, perhaps post them here (obscuring any sensitive information of course) and maybe someone could spot the problem.

  5. #5
    SitePoint Zealot
    Join Date
    Oct 2006
    Location
    Syracuse, NY
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The webhost fixed it. He didn't tell me what he specifically did, but he had to "edit" the spam filters. Wish I knew more for future cases of this problem. I'm going to assume its Swiftmailer as arkinstall said. Oh well, it works, problem solved... for now haha


Bookmarks

Posting Permissions

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