Rectangle 27 2

$fromMail = 'set your from mail';
$boundary = str_replace(" ", "", date('l jS \of F Y h i s A'));
$subjectMail = "New design submitted by " . $userDisplayName;


$contentHtml = '<div>Dear Admin<br /><br />The following design is submitted by '. $userName .'.<br /><br /><a href="'.$sdLink.'"><b>Click here</b></a> to check the design.</div>';
$contentHtml .= '<div><a href="'.$imageUrl.'"><img src="'.$imageUrl.'" width="250" height="95" border="0" alt="my picture"></a></div>';
$contentHtml .= '<div>Name : '.$name.'<br />Description : '. $description .'</div>';

$headersMail = '';
$headersMail .= 'From: ' . $fromMail . "\r\n" . 'Reply-To: ' . $fromMail . "\r\n";
$headersMail .= 'Return-Path: ' . $fromMail . "\r\n";
$headersMail .= 'MIME-Version: 1.0' . "\r\n";
$headersMail .= "Content-Type: multipart/alternative; boundary = \"" . $boundary . "\"\r\n\r\n";
$headersMail .= '--' . $boundary . "\r\n";
$headersMail .= 'Content-Type: text/html; charset=ISO-8859-1' . "\r\n";
$headersMail .= 'Content-Transfer-Encoding: base64' . "\r\n\r\n";
$headersMail .= rtrim(chunk_split(base64_encode($contentHtml)));

try {
    if (mail($toMail, $subjectMail, "", $headersMail)) {
        $status = 'success';
        $msg = 'Mail sent successfully.';
    } else {
        $status = 'failed';
        $msg = 'Unable to send mail.';
    }
} catch(Exception $e) {
    $msg = $e->getMessage();
}

This works fine for me.It includes mail with image and a link and works for all sorts of mail ids. The clue is to use all the header perfectly.

If you are testing it from localhost, then set the below before checking:

comment everything in D:/xampp/sendmail/sendmail.ini and mention the below under

D:/xampp/php/php.ini
sendmail_from = yourmailid@domain.com
sendmail_path = "\"D:\xamp\sendmail\sendmail.exe\" -t"
;sendmail_path="D:\xamp\mailtodisk\mailtodisk.exe"
mail.add_x_header=Off

email - How do I prevent mails sent through PHP mail() from going to s...

php email spam phpmailer
Rectangle 27 0

I know this already has an accepted answer but this is for others who might have had the same problem like me and ended up here. I had a website and mails send from my website ended up in spam boxes. Even if I tried using phpmailer and adding our companies mail-server as an SMTP.

However this could easily be resolved by sort of white listing the IP address of the website to the send filter of your mail server. How this is done exactly I don't know because the admin of the mail server did this for me(google it I guess).

Doing this means that if the receiving side does a DNS lookup or an IP lookup to your mail server. The mail-server tells the receiving side that it indeed was sent from him or his associating IP addresses and therefor it will not end up in the spambox.

However if you do this there is no need for the phpmailer and the standard mail() function works too.

php - mail delivered as spam - phpmailer, how to avoid - Stack Overflo...

php phpmailer spam spam-prevention
Rectangle 27 0

Recently I have a problem on sending e-mail with PHP Mailer function. Every mail which I sent from my script is straight way goes to spam folder on GMail, HotMail and other mail providers.

The issue has nothing to do with PHP Mailer, your code or even your host. But it has to do with overall outgoing mail settings on your hostname & even IP address. Meaning when you say this:

And I got result like SUCCESS which means Mail Successfully Sent. But when I check on my GMail the mail which I sent is on SPAM folder.

Correct, your mail was actually sent by the server. Which is good. But the mail servers on the receiving end somehow do not trust your hostname or IP address. A few things can be done to remedy this. Such as setting and SFP record in your hostnames DNS & setting a PTR (reverse DNS) record for the IP address of the server that is sending out the actual e-mails.

First & foremost, is vendarcorporates.com an actual domain? Doing a ping for it on this tool that pings globally shows consistent Unknown host: vendarcorporates.com results. If that is the case & you are trying to send with that, there is your problem right there.

As far as SPF records go, that is a DNS record that means Sender Policy Framework which translates to basically meaning: You, as the owner of a hostname allow these other IP addresses & hostnames to send e-mail on your behalf. More details here specifically this:

Even more precisely, SPFv1 allows the owner of a domain to specify their mail sending policy, e.g. which mail servers they use to send mail from their domain. The technology requires two sides to play together: (1) the domain owner publishes this information in an SPF record in the domain's DNS zone, and when someone else's mail server receives a message claiming to come from that domain, then (2) the receiving server can check whether the message complies with the domain's stated policy. If, e.g., the message comes from an unknown server, it can be considered a fake.

"v=spf1 ip4:123.45.67.890 ~all"

Assuming your domain is vendarcorporates.com, an SPF record like this would work as follows on the receiving end:

  • But this IP address is 123.45.67.890 and it is not connected to vendarcorporates.com. So lets check the SPF record.
  • Okay, I am reading the SPF record, and 123.45.67.890 is allowed to send e-mails for vendarcorporates.com, so lets let this message through.

Now that might not completely solve the issue. So in addition to an SPF record, you need to make sure your server has a valid PTR (reverse DNS) record that in some way matches your hostname.

Unlike a DNS record where a hostname is translated to an IP address, a PTR record is a reverse DNS record where an IP address is translated into a hostame. More info on Wikipedia.

How you can set a PTR is dependent on the way your host works.

  • And many others simply will not let you set a PTR record on your own. You need to contact your hosting service & ask them to setup a PTR record for you.

The reason PTR records are important is it is yet another check in the Is this SPAM? chain. So it would play out like this:

  • Hey, I just received an e-mail message from someone claiming to be vendarcorporates.com!
vendarcorporates.com

That second step where there is a check to see if an IP address of a mail is connected to vendarcorporates.com? That is the PTR record check.

Im fairly confident that having both the SPF & PTR record for your domain name & host set will clear up this issue.

And on the outside chance that you do have an SPF & PTR record set yet e-mails end up in SPAM? Well, that means your hostname and/or IP address is blacklisted. And that is a whole other can of worms for you to deal with. You can check your blacklist status with an online tool like MX Toolbox & follow individual service recommendations to request you be removed. But depending on the severity of your ranking in this list, this could either be a simple task or a very complex one.

Which is all to say, while tools like PHP Mailer ease the process of sending e-mails, the whole process of ensuring your e-mails are not tagged as SPAM is a whole other proverbial beast that has little to do with coding specifics.

php - All E-mails goes to spam folder of GMail, Hotmail and other emai...

php email phpmailer
Rectangle 27 0

What I would do, is use some SMTP server, say google, and PHPMailer, or anything similar. THis is probably the best solution for you too, because the usage of mail function in PHP might be a bit dangerous. Many mail servers think that these emails are spam, due to them not being sent by a known service. At first, try finding out if the unreceived emails have landed in the spam folder. If not, and if your time doe not allow a PHPMailer implementation, try sending the emails manually from a PHP snippet code, see what really happens.

Email newsletter from php mail function not sending anymore - Stack Ov...

php email
Rectangle 27 0

I tried both the mail() native function of the php and phpmailer. Both said that mail was sent and successful message appeared but the message was not delivered. I asked the technicians on the hosting server and they replied that spam blocker has blocked the messages. So they are asking for the contents and headers of the messages to confirm it was clear and to unblock the it from spamer. :)

php - PHPMailer having problems with sending mail - Stack Overflow

php phpmailer
Rectangle 27 0

<?php

$subject = "this is a subject";
$message = "testing a message";




  $headers .= "Reply-To: The Sender <sender@domain.com>\r\n"; 
  $headers .= "Return-Path: The Sender <sender@domain.com>\r\n"; 
  $headers .= "From: The Sender <sender@domain.com>\r\n";  
  $headers .= "Organization: Sender Organization\r\n";
  $headers .= "MIME-Version: 1.0\r\n";
  $headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
  $headers .= "X-Priority: 3\r\n";
  $headers .= "X-Mailer: PHP". phpversion() ."\r\n" ;



mail("reciever@domain.com", $subject, $message, $headers); 


?>

email - How do I prevent mails sent through PHP mail() from going to s...

php email spam phpmailer
Rectangle 27 0

Recently I have a problem on sending e-mail with PHP Mailer function. Every mail which I sent from my script is straight way goes to spam folder on GMail, HotMail and other mail providers.

The issue has nothing to do with PHP Mailer, your code or even your host. But it has to do with overall outgoing mail settings on your hostname & even IP address. Meaning when you say this:

And I got result like SUCCESS which means Mail Successfully Sent. But when I check on my GMail the mail which I sent is on SPAM folder.

Correct, your mail was actually sent by the server. Which is good. But the mail servers on the receiving end somehow do not trust your hostname or IP address. A few things can be done to remedy this. Such as setting and SFP record in your hostnames DNS & setting a PTR (reverse DNS) record for the IP address of the server that is sending out the actual e-mails.

First & foremost, is vendarcorporates.com an actual domain? Doing a ping for it on this tool that pings globally shows consistent Unknown host: vendarcorporates.com results. If that is the case & you are trying to send with that, there is your problem right there.

As far as SPF records go, that is a DNS record that means Sender Policy Framework which translates to basically meaning: You, as the owner of a hostname allow these other IP addresses & hostnames to send e-mail on your behalf. More details here specifically this:

Even more precisely, SPFv1 allows the owner of a domain to specify their mail sending policy, e.g. which mail servers they use to send mail from their domain. The technology requires two sides to play together: (1) the domain owner publishes this information in an SPF record in the domain's DNS zone, and when someone else's mail server receives a message claiming to come from that domain, then (2) the receiving server can check whether the message complies with the domain's stated policy. If, e.g., the message comes from an unknown server, it can be considered a fake.

"v=spf1 ip4:123.45.67.890 ~all"

Assuming your domain is vendarcorporates.com, an SPF record like this would work as follows on the receiving end:

  • But this IP address is 123.45.67.890 and it is not connected to vendarcorporates.com. So lets check the SPF record.
  • Okay, I am reading the SPF record, and 123.45.67.890 is allowed to send e-mails for vendarcorporates.com, so lets let this message through.

Now that might not completely solve the issue. So in addition to an SPF record, you need to make sure your server has a valid PTR (reverse DNS) record that in some way matches your hostname.

Unlike a DNS record where a hostname is translated to an IP address, a PTR record is a reverse DNS record where an IP address is translated into a hostame. More info on Wikipedia.

How you can set a PTR is dependent on the way your host works.

  • And many others simply will not let you set a PTR record on your own. You need to contact your hosting service & ask them to setup a PTR record for you.

The reason PTR records are important is it is yet another check in the Is this SPAM? chain. So it would play out like this:

  • Hey, I just received an e-mail message from someone claiming to be vendarcorporates.com!
vendarcorporates.com

That second step where there is a check to see if an IP address of a mail is connected to vendarcorporates.com? That is the PTR record check.

Im fairly confident that having both the SPF & PTR record for your domain name & host set will clear up this issue.

And on the outside chance that you do have an SPF & PTR record set yet e-mails end up in SPAM? Well, that means your hostname and/or IP address is blacklisted. And that is a whole other can of worms for you to deal with. You can check your blacklist status with an online tool like MX Toolbox & follow individual service recommendations to request you be removed. But depending on the severity of your ranking in this list, this could either be a simple task or a very complex one.

Which is all to say, while tools like PHP Mailer ease the process of sending e-mails, the whole process of ensuring your e-mails are not tagged as SPAM is a whole other proverbial beast that has little to do with coding specifics.

php - All E-mails goes to spam folder of GMail, Hotmail and other emai...

php email phpmailer
Rectangle 27 0

The problem is simple that the PHP-Mail function is not using a well configured SMTP Server.

Nowadays Email-Clients and Servers perform massive checks on the emails sending server, like Reverse-DNS-Lookups, Graylisting and whatevs. All this tests will fail with the php mail() function. If you are using a dynamic ip, its even worse.

Use the PHPMailer-Class and configure it to use smtp-auth along with a well configured, dedicated SMTP Server (either a local one, or a remote one) and your problems are gone.

phpmailer - sending email via php mail function goes to spam - Stack O...

phpmailer php email-spam
Rectangle 27 0

To see if the mail server that you are sending these through has a glaring problem that would cause other mail servers to think it's a spammer, try sending a message from your script to check-auth@verifier.port25.com. This service will do a bunch of checks, and you'll get a report back with ton of information, such weather or not your mail server's DNS is setup correctly, whether your mail server's IP is on any black lists, if you have a problem with your SPF records, etc.

php - My phpmailer script goes to spam - Stack Overflow

php email smtp phpmailer spam
Rectangle 27 0

As Webnet said, it could be the content of the email or the source. For example, my company is hosting a website on Amazon AWS but password and account recovery emails are being flagged as spam. Solution? We used Zend::Mail to connect to and send the emails from a non-AWS host.

php - Prevent order confirmations sent via PHPMailer from ending up in...

php email spam phpmailer
Rectangle 27 0

Magento uses the MX record and unauthenticated email services to send email.

Most SMTP servers consider mail from these sources to be spam nowdays.

Get Ashley Shroeder's secure SMTP module and set it up so you have to log into an email account that sends email using SSL/TLS encryption. Then set up SPF records showing the authorized servers that are supposed to be the email sources for your domain.

php - Transaction mails from my website goes as spam - Stack Overflow

php magento email phpmailer spam
Rectangle 27 0

Normally, an email is marked spam if its "From:" header value's domain part does not match the domain that is actually sending the email.

The easiest way to bypass this is to use a "From:" that matches your domain, and use a "Reply-To:" header to the email that you set in "From:" header

For eg: if you are sending mail from mydomain.com and your from email is me@hotmail.com, you should change your headers to this:

i have check with From : info@longtail.info and Reply-To: info@longtail.info still same problem

php - Everytime my mail goes to spam in phpmailer - Stack Overflow

php email phpmailer email-spam
Rectangle 27 0

Make sure your $message has proper html and also has the tags as well. You can try sending a real email message, some of the larger companies will block spam messages. If your message is just "test" or "testing" then you may never get it. You may also have issues with being blocked if you are sending from a shared hosting server or IP.

A sure fix is to setup an actual email account, and send mail through there using SMTP.

Hi, Stomo21. mailing through host SMTP and PHPMailer class solve all the problem! Thank you very much!!

php mail function failed to send html email to hotmail and aol address...

php
Rectangle 27 0

I experienced same. My website sends requests for data confirmation to users a few times each day while I do my daily data maintenance. I sent a test message to my Gmail address and found that if you read your mail through Gmail webmail interface it will sometimes tell you Why the message was spammed. Very useful. It gave the reason "A lot of messages from hp19.hostpapa.com were spam". I am on a budget shared server and I assume a hundred other spammers have bought accounts on the same machine as mine and are using it for evil. My site is non-profit so buying a dedicated box to avoid spam is not an option. So...

My solution was to change my CMS to not use PHP mail() at all. Now my CMS simply displays the message and a mailto: link with Subject parameter set. Now my process is to hit CTRL+C, Click the link, CTRL+V, and hit send. Messages are sent from my computer's IP Address (not on any blacklist) using my mail client, Thunderbird.

This takes me just a couple of seconds longer than it did when my CMS used PHP mail() to send the message for me. However I have found I am receiving a lot more replies so I am happy that the vast majority of messages are not getting spam-binned.

I appreciate this manual solution is not appropriate for automated bulk messaging but for small non-profit sites on shared server who trigger each message with a click, I thought it was worth sharing.

PHP bulk mail using "phpmailer" lands in SPAM - Stack Overflow

php phpmailer spam bulk-mail
Rectangle 27 0

You've got your transports mixed up. -f in the mail() function is an additional parameter passed to the underlying sendmail binary that sets the envelope sender of the message (and officially it should not have a space after it, like -fme@test.com). However, it does not apply when you are sending via SMTP becasue you get control over that parameter with the Sender property. You should do this:

$mail->Sender = 'me@test.com';

If you send using SMTP it will use that as the envelope sender (as the content of the SMTP MAIL FROM command), and if you send via isMail() or isSendmail() transports, it will set the sender via the -f property.

Also make sure you're using the latest PHPMailer from GitHub.

can you point me to any documentation i can get on isMail() and isSendmail()? I have been not using these, but mail still sends - not really sure what the implications are for those settings.

API docs on those are here, but there's not much to them - they are much less complex than isSMTP(), but you can see in the source code here and here that they both make use of the -f param with the Sender property.

php - phpmailer complications for spam filters "-f" - Stack Overflow

php smtp phpmailer email-headers envelope
Rectangle 27 0

This involves setting a few mail headers to beat the filters.

I have added the following to the very start of php mailers CreateHeader method...

$result = '';

$result .= $this->HeaderLine("Organization" , SITE); 
$result .= $this->HeaderLine("Content-Transfer-encoding" , "8bit");
$result .= $this->HeaderLine("Message-ID" , "<".md5(uniqid(time()))."@{$_SERVER['SERVER_NAME']}>");
$result .= $this->HeaderLine("X-MSmail-Priority" , "Normal");
$result .= $this->HeaderLine("X-Mailer" , "Microsoft Office Outlook, Build 11.0.5510");
$result .= $this->HeaderLine("X-MimeOLE" , "Produced By Microsoft MimeOLE V6.00.2800.1441");
$result .= $this->HeaderLine("X-Sender" , $this->Sender);
$result .= $this->HeaderLine("X-AntiAbuse" , "This is a solicited email for - ".SITE." mailing list.");
$result .= $this->HeaderLine("X-AntiAbuse" , "Servername - {$_SERVER['SERVER_NAME']}");
$result .= $this->HeaderLine("X-AntiAbuse" , $this->Sender);

that was done some time ago - I haven't revisited for about a year I think! Try it and come back if you still have problems.

if you could accept as answer I'd be over the moon! (people lik it when you accept answers - they get credit and you get a better reputation)

I'm not question owner, man!))

@IanWood I was looking for emails to gmail. Mine were already working fine to hotmail. Anyways +1 for the headers. didn't knw we could do this

php - PHPmailer sending mail to spam in hotmail. how to fix? - Stack O...

php email phpmailer spam hotmail
Rectangle 27 0

It's better to use PHPMailer or Swift Mailer in combination with a smtp server (e.g. gmail). Mail send from php (mail()) is often seen as spam by a lot of spamfilters...

email - PHP mail function (2) - Stack Overflow

email sendmail php
Rectangle 27 0

$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
$headers .= "From: successive.testing@gmail.com" . "\r\n" .
"Reply-To: successive.testing@gmail.com" . "\r\n" .
"X-Mailer: PHP/" . phpversion();

For a few reasons.

You could also try changing the $from to:

$from = "successive.testing@gmail.com";

Try using the SMTP server of your ISP.

X-MSMail-Priority: High

It was actually really easy to enable these settings in cPanel under Email Authentication. I can't believe I never saw that before.

It only works with sending through SMTP using phpmailer by the way. Any other way it still is marked as spam."

PHPmailer sending mail to spam in hotmail. how to fix http://pastebin.com/QdQUrfax

If by apostrophes you meant single quotes: stackoverflow.com/questions/3446216/ What would the $from do in that script?

@Lenin I call them apostrophes. For example I've just used one now. As for 'single quotes' are the same character on my/the keyboard.

Hi @DineshNagar. Very strange. I used single quotes in headers before and they always landed in the Spam box. When I switched to double quotes, all was fine.

phpmailer - sending email via php mail function goes to spam - Stack O...

phpmailer php email-spam
Rectangle 27 0

What we usually do with e-mail, preventing spam-folders as the end destination, is using either Gmail as the smtp server or Mandrill as the smtp server.

phpmailer - sending email via php mail function goes to spam - Stack O...

phpmailer php email-spam
Rectangle 27 0

Based on you code i notice that you are sending an email directly from you web page on your domain.

When the recipient receive the emails the mail service of the recipient my test a reverse DNS of the sender of the mail. So the sender is from @hotmail.com but the mail comes from your domain which of course is not hotmail.com.

I think a possibile solution is: in you php code use autenticate with smpt and send from there the mail!

php - Everytime my mail goes to spam in phpmailer - Stack Overflow

php email phpmailer email-spam