PHPMailer can't send email to Hotmail account

Hi…
Currently i’m using PHPMailer class for sending email through PHP script.
But when i sent it to a Hotmail account, the account never received it.
How to setup the class so it can send email to Hotmail account?
Do i need another class? Something like PHPGMailer for Gmail account?
Can someone guide me, pls? Thanks in advance…

I think hotmail sets your emails as spam, same happened to me, no solution at the time :frowning:

It could be your server is on a black list for them. In my testing I’ve realized hotmail is very cut and dry. If you’re emailing from a server they suspect it doesn’t even try to figure out what is in your email it simply discards it.

I quote your words.
I think hotmail is scking too much nowadays, no Outlook, no Email Grabbers, everything is spam and live hotmail scks too much.

I now think that people should build their own email servers, only for personal use. That would be the solution to avoid things like hotmail.

Try to buy a SMTP service, that you are sure that is not marked as spam in hotmail.

One strange thing i saw, is that when i use PHP’s mail function hotmail cuts it.
But when my PHPbb forum sends mails (is not using any SMTP) hotmail accepts them all…

Are there different ways to send emails in PHP?
Or is some special gateway for emails that doesnt put publicity in the sent emails?

This is what i got when i check my SMTP server :frowning:

Your e-mail was rejected for policy reasons on this gateway. Reasons for rejection may be related to content such as obscene language, graphics, or spam-like characteristics (or) other reputation problems.

They reject the email that i sent from my PHP script :frowning:
There is still no solution for this one, isn’t it?

No.

Get another SMTP service. :frowning:

Can I see the email you’re trying to send? Are you setting the content type of the message? A valid from address with a name attached? Are you sending content of any length? It sounds like you’re not sending properly formatted emails if PHPBB is getting through but yours aren’t. Try to look at PHPBB mail function and see what they’re doing differently or if you have access to spam assassin send your mail to an address that will get ran through it. Then check the results to see why you’re getting black listed and fix! :smiley:

Hi Charles256, this is the code for sending email.
Do you think the contents looks suspicious so Hotmail rejects my email?
Thx for your help :slight_smile:


<?php
	require("class.phpmailer.php");
	require("class.phpgmailer.php");

	$user = $_SESSION["username"];
	$nameOfUser = $_SESSION["name"];
	$sentTo = $_POST["textfield"];

	$emailTo = $sentTo;
	$subject = "$nameOfUser has invited you to join Sig-Share.com";

	$msg = "You are invited to join $nameOfUser's network of friends.<br> ";
	$msg .= "By joining Sig-Share.com you are able to share your data securely, upload audio files, etc.<br><br>";
	$msg .= "Please, do not reply to this email address <br /> <br />";
	$msg .= "<a href=http://innoform.no-ip.com/site/register.php> Join Sig-Share now </a>";

	//Check the domain name, i.e if it is a gmail account use PHPGmailer to send the mail
	$splitString = strstr($sentTo, '@');
	$getDomain = substr($splitString, 1, strlen($splitString));

	if(strcmp($getDomain, "gmail.com") != 0) {
		echo "Not gmail";
		$mail = new PHPMailer();
		$mail->IsSMTP();
		$mail->Host = "smtp.innoform.no-ip.com;";
		$mail->Port = 25;
		$mail->SMTPAuth = true;
		$mail->Username = "admin@sig-share.com";
		$mail->Password = "adminsig";

		$mail->From = "admin@sig-share.com";
		$mail->AddAddress($sentTo);
	}
	else {
		echo "Gmail";
		$mail = new PHPGMailer();
		$mail->IsSMTP();
		$mail->SMTPAuth = true;

		$mail->Username = "admin.sig.share@gmail.com";
		$mail->Password = "retsiger";

		$mail->From = "admin@sig-share.com";
		$mail->FromName = "Sig-Share's Admin";
	}

	// set word wrap
	$mail->WordWrap = 50;
	// send as HTML
	$mail->IsHTML(true);

	$mail->AddAddress($sentTo);
	$mail->Subject = $subject;
	$mail->Body = $msg;

	if(!$mail->Send())
	{
		$_SESSION["inviteMsg"] = "Invitation was not sent, reason : $mail->ErrorInfo";
	}
	else {
		$_SESSION["inviteMsg"] = "Invitation has been sent to $emailTo";
	}

	header("Location: ./home.php");
?>

Use AddReplyTo ( deined in phpmailer) so that the user has a reply to address. Make sure the from address is from the same domain as the email is coming from… Be sure to use a valid from address. Use <br /> or <br> not both. And that’s all I can think of. Also, consider setting up spamassassin http://wiki.apache.org/spamassassin/SpamAssassin and running a sample email through it to see how your email scores.

Use SMTP Authentication and make sure you use headers and define everything you can, this helps get you email through. Most spam is detected by poorly formed emails, that and the word ‘viagra’. lol

LOL

ok, forget what i said about buying a new SMTP, i think that solves the problem :lol:

Mr Jojo : The problem is i’m only a student :wink: I’m doing my final project now :slight_smile:

dakine : I have set the authentication to true.

Charles256 : Is it possible if i don’t put the reply address? Because i’m not planning to receive any email for this email address. The email address is only used to send an invitation to user.
I’ve made some changes like what you’ve suggested me. The good news is that i got no more error messages @ my SMTP server :smiley: But…The bad news is the Hotmail account still doesn’t receive the email until now, not even in the junk folder. Can you help me again, pls? I’m really desperate now :frowning:
Thanks in advance

put a valid reply-to address even if you don’t want to receive emails… hotmail may be assuming since there’s no reply to address your spam.

Yes…
Thanks a lot Charles256 :wink:
It works…
I also migrate my stmp server to the one who has a fix address and not dynamic like mine :frowning:

PHPMailer is cool. Thx a lot, really appreciate your help.

No problemo.

Glad you found a solution, but it will all be for not if you don’t better protect your script from injection attacks.

Im having trouble sending mail to hotmail too and i already do everything explained here, but still dont work. If i use outlook express with the same acount information, the mail arrive to destination, but not from phpmailer. I even try to mimick the headers from outlook(im a noob:D). Mail from phpmailer do arrive to others domains like yahoo.

Any sugestions??