Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8099299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:21:49+00:00 2026-06-05T22:21:49+00:00

I am creating a site for me only that will run from my server.

  • 0

I am creating a site for me only that will run from my server. I would like it to send me emails using php which is setup, but the emails go into my spam folder in gmail. How can I change this in gmail, not php, to send these emails to my inbox? I have tried using mail() and phpmailer().

Here is the Php code that I have.

$mail = new PHPMailer();

$body = "email from server - testing.";
$from = "email@mysite.com";
$email = "myemail@gmail.com";

$mail->IsSMTP(); 
$mail->Host       = "localhost"; 
$mail->SMTPDebug  = 2;

$mail->SetFrom($from, "mysite.com");
$mail->AddReplyTo($from, "mysite.com");

$mail->Subject    = "emails";

$mail->MsgHTML($body);

$address = $email;
$mail->AddAddress($address, "me");

// $mail->Send();

if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T22:21:51+00:00Added an answer on June 5, 2026 at 10:21 pm

    I cannot see anything wrong with your code, since you seem to be setting the From correctly. I would however suggest that you check the actual headers received by GMail (Show Original under message options on the email/message) and check that the From header is correct. An incorrect sender is a common cause of issues like this.

    As sarnold says above there is a degree of guess work involved, but I suggest you look at one or more of the following:

    • Check/Setup SPF or DKIM for your domain
    • Check/Setup a reverse dns record for the IP address used to send the emails
    • Check if the IP address you are sending from is on any blacklists (contact your ISP if it is). MXToolBox BlackList Checker may be useful for checking multiple blacklists
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a mobile website that will include a page from which people can
I am creating a site in flash that is reading in entries from a
I'm creating an site which allows users to upload photos. It's a linux server.
I'm creating a site using the Twitter Bootstrap , but I've discovered that the
I am creating site with php. On localhost all works well. On my hosting
I creating a site in JRuby on Rails (JRuby 1.3.0 ). I am using
I'm creating new Site Definitions using this method: http://weblogs.asp.net/paulballard/archive/2007/04/09/creating-a-custom-sharepoint-2007-portal-site-definition-using-the-portalprovisioningprovider-class.aspx and when they get created,
I'm creating a site who's users will include customers and different levels of Admins.
I'm working on a site that will go on my company's intranet. I developed
I'm building a site which will provide product information in two languages: English and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.