We unable send an email from CRM at hotmail. We use google app as email host. Our custom applications PHP by our own developer. We able send email at every domain like yahoo, AOL and other domain except hotmail account.
We checked our PHPMailer script and also run google smtm but nothing is working. Please help me out of this issue.
<html>
<head>
<title>PHPMailer - Mail() basic test</title>
</head>
<body>`enter code here`
<?php
require_once('../class.phpmailer.php');
$mail = new PHPMailer(); // defaults to using php "mail()"
//$mail->IsHTML(true);
//$mail->CharSet = 'windows-1251';
$body = 'This is ....';
$mail->AddReplyTo("task#mytasker.com","Mytasker1");
//$mail->SetFrom('deep_m#outlook.com', 'Deep');
//$mail->SetFrom('saikat_mytasker#hotmail.com', "Saikat Mallick");
$mail->SetFrom("task#mytasker.com","Mytasker");
$address = "saikat#mytasker.com";
//$mail->AddAddress('saikat_mytasker#hotmail.com', "Saikat Mallick");
$mail->AddAddress('deep_m#outlook.com', 'Deep');
$mail->AddAddress($address, "Saikat Mallick");
$mail->Subject = "Mytasker 123 ...";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
//$mail->AddAttachment("images/phpmailer.gif"); // attachment
//$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
</body>
</html>
This is probably hotmail servers are classifying your email content or servers as spam and is auto blocked. Though this is a little off topic but may i suggest to switch to third party email senders such as mandrill or mailjet. In this way, you will mitigate the risk of your content / servers being classified / marked as spam and ensure 99.99% hitting inbox rate
Related
So as stated in the title I wanna created a function different from mail to send mail(confusing ik)
So using mail () it sends the email from my server regardless of the headers I put so I need to create a function to send the actual email from a set email
Let's say I have an email
flameforgedinc#gmail.com
Lets say I have a bunch of emails in a mailing list
Now I have some code that's gonna use this function to email each one
So this code use's cMail ($to, $sub, $msg, $from);
And the email will appear to the user
From: flameforgedinc#gmail.com
And I actually want it to come from my email
If I use mail then it comes from my server and displays altervista00000 and I don't want the plus my server limits the mail() function to activation emails and I need to be able to send newsletters
Any ideas or workarounds??
My name is Pavel Tashev. I will try to help ;)
The easiest and more correct way from technical point of view is to use your own Mail server which hosts your email account and sends your emails. The purpose of PHP in that cases will be to tell the mail server to send email X to a list of emails Y, from an email account Z.
This will solve all your problems:
max allowed emails per hour;
sender name;
The good news is that you already have a Gmail account which is hosted by Google and you don't need to build your own mail server. You can use Google's mail server. Also, for the email sending I would advice you to use PHPMailer (url: https://github.com/PHPMailer/PHPMailer).
Here is how we can do all of this. Follow these steps:
Integrate PHPMailer in your project. If you use composer, that will be a straightforward process. If you don't, simply download the code and include this file PHPMailerAutoload.php in your project. Just follow the instructions on Github. It is really easy.
So, when you are ready with the installation of PHPMailer you must tell it to connect to your mail server. For Gmail and your email account this would look like this:
<?php
require 'PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'flameforgedinc#gmail.com';
$mail->Password = 'PUT-YOUR-PASSWORD-HERE';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->setFrom('flameforgedinc#gmail.com', 'YOU CAN PUT YOUR NAMES HERE IF YOU WANT');
The final step is to set up the recipient and the content of the email:
$mail->addAddress('some.user#example.net', 'Joe User');
$mail->addAddress('seconrd.user#example.com', 'The name is optional');
$mail->addReplyTo('flameforgedinc#gmail.com', 'YOU CAN PUT YOUR NAMES HERE IF YOU WANT');
$mail->isHTML(true);
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
now you will have to send the email:
!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
I hope that will help.
I have tried to make an email service on my web site, but after I tried the code below, I find that my Hotmail account cannot receive the test email but others are fine (Gmail and Yahoo). I am using Godaddy hosting. Please help.
My code:
<?php
require 'PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->setFrom('example#example.com', 'example');
$mail->addAddress('myemailid#hotmail.com', 'myname');
$mail->Subject = 'PHPMailer mail() test';
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
$mail->AltBody = 'This is a plain-text message body';
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
I had the same issue in the past and the solution was to apply for ip Whitelisting. Here's the steps to do that.
Step 1
Browse to the Hotmail Postmaster website
Step 2
Click on the link for "Email I send is being blocked or junked by Hotmail." You'll be redirected to the Hotmail Live Troubleshooting page.
Step 3
Review the troubleshooting guide to diagnose a problem. Email from your IP address might be automatically identified as junk mail for a number of reasons. Dynamic IP addresses may have been used by other parties for spam, or the DNS entry for your domain might not show up as legitimate to Hotmail servers. Identify and address the issues causing your email to Hotmail users to be blocked as junk.
Step 4
Fill out an application to the Junk Mail Reporting Program . This will help Hotmail identify your mailing domain and add it to a whitelist.
I am using phpmailer() to send email from my website. But when It's sent email I see following warning message.
I can't understand why it's showing and how can I fix this error message. Can anyone tell me about it ?
Following is my code :
<?php
require_once("mail/PHPMailerAutoload.php");
$mail = new PHPMailer;
$mail->setFrom($email);
$mail->addReplyTo('toemail#gmail.com', 'First Last');
$mail->addAddress('toemail#gmail.com', 'First Last');
$mail->Subject = 'PHPMailer mail() test';
$mail->msgHTML(file_get_contents('mail/contents.html'), dirname(__FILE__));
$mail->AltBody = 'This is a plain-text message body';
$mail->addAttachment('mail/images/phpmailer_mini.png');
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
Easy, you could read about SPF DNS Record.
When you send and email, services like gmail check if the sender ip is the same that the domain of the email, for example:
You send an email as "foo#gmail.com" to "bar#hotmail.com". Your
server ip is 1.1.1.1
Hotmail receives an email from "foo#gmail.com" so check if gmail.com
ip (2.2.2.2) is the same as your server (1.1.1.1). The answer is NO,
so the email is marked as spam.
To avoid that your email will marked as spam, you could use
phpmailer using a real google account and provide phpmailer the user
and password to send the email.
I tried to explain you the situation very easy on point 2. Real situation is a bit complicated but the logic is the same, check ip sender and origin. Read about SPF (and dkim) because is what are you looking for :)
http://en.wikipedia.org/wiki/Sender_Policy_Framework
I am working with PHP Mailer to send the mails. It working fine in my localhost. And when i tested it from my Linux server, i am receiving mails to all as fine except hotmail . Please find the below code im running.
<?php require_once('PHPMailer/class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->From = "no-repy#gmail.com"; //From Address -- CHANGE --
$mail->FromName = "myname"; //From Name -- CHANGE --
$mail->AddAddress('*****#hotmail.com'); //To Address -- CHANGE --
$mail->AddAddress('*****#gmail.com');
$mail->AddReplyTo("no-reply#gmail.com", "gmail"); //Reply-To Address -- CHANGE --
$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->IsHTML(false); // set email format to HTML
$mail->Subject = "AuthSMTP Test";
$mail->Body = "AuthSMTP Test Message!";
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
?>
After running this im getting the response as
Message has been sent
But receiving mail to my Gmail a/c, not to the Hotmail.
Please help regarding this one.
Thanks in advance.
I had the same problem; indeed mail arrived at other destinations except hotmail.
It turns out MS*** recently decided to block emails coming from godaddy mailers (secureserver.net). And these emails are not even sent to spam/deleted folders for hotmail recipients, they are just sent to the ether. Believe it or not.
After calls and mails to both parties, where of course you get no useful info or solution, I just decided to bypass their mailers and instead use a 3rd party service: sendgrid.com. Didn't use their smtp solution, as GD seems to blocks external smtp (at least in shared hosting); but the sendgrid-php works just fine.
require("class.phpmailer.php");
$mail = new PHPMailer()
$mail->From = "sender#gmail.com";
$mail->AddAddress("recipient#gmail.com"); // name is optional
$mail->AddReplyTo("sender#gmail.com");
$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = "Here is the subject";
$mail->Body = "This is the HTML message body <b>in bold!</b>";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
I don't know what headers i need to add, to send the email NOT as spam, and how can i use this?
//$mail->IsSMTP(); // is this necessary?
//$mail->Host = "some host ip"; // what i need to write here?
//$mail->SMTPAuth = true; // is this necessary to send email NOT as spam?
//$mail->Username = "test"; // and this?
//$mail->Password = "secret"; // and this?
for some time googling , I didn't find any clear information about how to send an email NOT as spam... any ideas?
Unfortunately, the mail server you're currently using has probably been sending out junk in the past. Are you on a shared hosting plan? Because if you are, it's possible that other websites on the same hosting plan as you have been sending out spam/suspicious/junk emails via the same the mail server. To try and avoid this issue, you should try and not use spoofed FROM headers. Unfortunately, that's unlikely to do anything if Gmail etc have already identified the mail server you're using as an origin for spam.
Make sure the From header really matches e-mail address available on the server you're sending it from - spoofing From headers (sending from host.com but saying it's from abc#otherhost.com) raises your spam score.
Also - is the HTML page well-formed to prevent being marked as spam? For example, does it have an unsubscribe link? Or isn't the subject of that mail something like "free something for you"?
I am not sure but see below URL I think it is very help full to you.
How do I prevent mails sent through PHP mail() from going to spam?
How do I prevent mails sent through PHP mail() from going to spam?