Hi, I'm trying to finish a scripts to manage newsletter from a website but I encountered a strange weird stuff just at the end.
Basically when I send emails everything seem to be alright. I sent 5 email. 3 of them was received perfectly but the other 2 not. Just empty. These email that read as empty the email I sent are @gmail and @hotmail.

So I had a look at the various headers.

In Gmail I got this:

Received-SPF: neutral (google.com: 62.149.158.122 is neither permitted nor denied by best guess record for domain of carlomascella@ymail.com) client-ip=62.149.158.122;
Authentication-Results: mx.google.com; spf=neutral (google.com: 62.149.158.122 is neither permitted nor denied by best guess record for domain of carlomascella@ymail.com) smtp.mail=carlomascella@ymail.com

And in Hotmail this:

Authentication-Results: hotmail.com; sender-id=temperror (sender IP is 62.149.158.115) header.from=info@perilpoliclinico.org; dkim=none header.d=perilpoliclinico.org; x-hmca=none

Could be the problem related to this? If yes what I can do? I had a look googling but seem that all this is managed server-side...

Thanks for help.

Shella

Recommended Answers

All 4 Replies

Shella,

Can you post the e-mail code (not the content)

thanks,

Pamapas

are using phpmail to deal with mime? Why not give try to PHPMailer/SwiftMailer?
As adviced above please post relevant code (not whole thing)

Hi, here the whole code. No problem for the cotent, in nothing important.
Look the screenshot: on Thunderbird the same-same email is viewed well but in GMail fail! Here http://www.shella.it/screenshot.jpg

@evstevemd: I will give a look if I can't resolve this thanks. I just try to do something mine. I don't like the idea to have third party sw on the same backend to avoid users logging in different system into the same backend... anyway this is another story ;-)

Delivered-To: carlomascella@gmail.com
Received: by 10.231.14.76 with SMTP id f12cs55618iba;
        Mon, 7 Nov 2011 04:33:02 -0800 (PST)
Received: by 10.227.204.141 with SMTP id fm13mr29622283wbb.12.1320669178653;
        Mon, 07 Nov 2011 04:32:58 -0800 (PST)
Return-Path: <anonymous@webxc27s05.ad.aruba.it>
Received: from smtpsmart1.aruba.it (smtpweb120.aruba.it. [62.149.158.120])
        by mx.google.com with SMTP id m20si12176553wbh.35.2011.11.07.04.32.58;
        Mon, 07 Nov 2011 04:32:58 -0800 (PST)
Received-SPF: pass (google.com: domain of anonymous@webxc27s05.ad.aruba.it designates 62.149.158.120 as permitted sender) client-ip=62.149.158.120;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of anonymous@webxc27s05.ad.aruba.it designates 62.149.158.120 as permitted sender) smtp.mail=anonymous@webxc27s05.ad.aruba.it
Received: (qmail 531 invoked by uid 89); 7 Nov 2011 12:32:57 -0000
Received: by simscan 1.2.0 ppid: 32598, pid: 32602, t: 1.9554s
         scanners: clamav: 0.88.4/m:40/d:1945 spam: 3.1.4
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on
	smtpsmart1.fe.aruba.it
X-Spam-Level: ****
X-Spam-Status: No, score=4.1 required=6.0 tests=BAYES_50,HTML_IMAGE_ONLY_12,
	MIME_HEADER_CTYPE_ONLY,RDNS_NONE autolearn=disabled version=3.2.5
Received: from unknown (HELO webxc27s05.ad.aruba.it) (62.149.143.65)
  by smtpsmart1.fe.aruba.it with SMTP; 7 Nov 2011 12:32:55 -0000
Received: (qmail 2330 invoked by uid 18949921); 7 Nov 2011 12:32:55 -0000
Date: 7 Nov 2011 12:32:55 -0000
Message-ID: <20111107123255.2329.qmail@webxc27s05.ad.aruba.it>
To: carlomascella@gmail.com
Subject: Lorem Ipsum...
From: "Associazione Per Il Policlinico" <info@perilpoliclinico.org>
Reply-To: info@perilpoliclinico.org
Content-Type: multipart/alternative; boundary="PHP-alt-e6029a27824f7bcc30e892ffd4b3cb71"

--PHP-alt-e6029a27824f7bcc30e892ffd4b3cb71 
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
--PHP-alt-e6029a27824f7bcc30e892ffd4b3cb71 
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

<html><head>
<title>:: PerIlPoliclinico.Org ::</title>
	<link href='http://www.perilpoliclinico.org/style.css' rel='stylesheet' type='text/css' />
	</head><body><p>
    <center>
				<div id='header-newsletter'>
				<center><img src='http://www.perilpoliclinico.org/images/header_newsletter.png' border='0'></center>
				<h3 align='left'>NEWSLETTER</h3>
                <p align='left'>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum</p><p><a href='<--unsub-->'>Clicca qui per non ricevere più le newsletter</a></p></div></center></body></html>

--PHP-alt-e6029a27824f7bcc30e892ffd4b3cb71--

And this is a part of the php code, hope can help.

//create a boundary string. It must be unique
//so we use the MD5 algorithm to generate a random hash
$random_hash = md5(date('r', time()));
//define the headers we want passed. Note that they are separated with \r\n
$headers = "From: \"$fromname\" <$fromemail>\r\nReply-To: info@perilpoliclinico.org";
//add boundary string and mime type specification
$headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\"";
//define the body of the message.
ob_start(); //Turn on output buffering
?>
--PHP-alt-<?php echo $random_hash; ?> 
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

<?php echo $text; ?>

--PHP-alt-<?php echo $random_hash; ?> 
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

<html><head>
<title>:: PerIlPoliclinico.Org ::</title>
	<link href='http://www.perilpoliclinico.org/style.css' rel='stylesheet' type='text/css' />
	</head><body><p>
    <center>
				<div id='header-newsletter'>
				<center><img src='http://www.perilpoliclinico.org/images/header_newsletter.png' border='0'></center>
				<h3 align='left'>NEWSLETTER</h3>
                <p align='left'><?php echo $text; ?></p><p><a href='<--unsub-->'>Clicca qui per non ricevere più le newsletter</a></p></div></center></body></html>

--PHP-alt-<?php echo $random_hash; ?>--
<?
//copy current buffer contents into $message variable and delete current output buffer
$messaggio = ob_get_clean();

$x = 1;

while ($do = mysql_fetch_array($query)) {
$address = $do["email"];
$texts = str_replace("<--unsub-->", $path . "/entry.php?action=add&listID=" . $listID .
"&email=" . $address . "&what=unsub", $messaggio); //Prima di $messagio era $text
//$mail_send = mail($address,$subject,$texts,$headers);
$mail_send = mail($address,$subject,$messaggio,$headers);

if(!$mail_send) {
errorMsg("Message not sent to $address.");
}

Thanks so much,

Shella

dealing with mime can be dirty so I suggest you go PHPMailer!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.