473,782 Members | 2,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mail() - arriving at some addresses, never at others

Hi folks,

HELP!!!!

My habitual use of mail() is causing me some grief. I am having
slightly different results depending on the server I use but the gist
is that mail() is returning 1, and I can send mail to yahoo.com,
gmail.com, and hotmail.com no problem. 100% success.

Same script from some servers gets mail through to cox.net addresses,
my ISP.

However, my own domain, nolaflash.com is not receiving these mails at
all, nor are several other domains on shared hosting servers.
NolaFlash.com and Artifexdev.com for two examples.

I have tried running the scripts on three different servers with the
only difference that the Cox address works on one AND if I host the
script on NolaFlash then the mail to NolaFlash addresses gets through.

Here are four ways I have tried this:

// NO HEADERS
$to = 's******@gmail. com';
$subject = "Inquiry from some.com";
$msg = 'whatever';
$result = mail($to, $subject, $msg);

// FULL HEADERS
$to = 's******@gmail. com';
$subject = "Inquiry from ENLA.com: $_POST[name] $_POST[company]";
$headers = "From: $_POST[name] <$_POST[email]>\r\n";
$headers .= "Reply-to: $_POST[name] <$_POST[email]>\r\n";
$headers .= "Return-Path: $_POST[name] <$_POST[email]>\r\n";
$headers .= "Message-ID: <" . date("YdmHis") .
".TheSystem@".$ _SERVER['SERVER_NAME'].">" . "\r\n";
$headers .= "X-Mailer: PHP v". phpversion() . "\r\n";
$result = mail($to, $subject, $msg, $headers);

// FULL HEADERS PLUS -f FLAG to set the envelope sender address
$to = 's******@gmail. com';
$subject = "Inquiry from ENLA.com: $_POST[name] $_POST[company]";
$headers = "From: $_POST[name] <$_POST[email]>\r\n";
$headers .= "Reply-to: $_POST[name] <$_POST[email]>\r\n";
$headers .= "Return-Path: $_POST[name] <$_POST[email]>\r\n";
$headers .= "Message-ID: <" . date("YdmHis") .
".TheSystem@".$ _SERVER['SERVER_NAME'].">" . "\r\n";
$headers .= "X-Mailer: PHP v". phpversion() . "\r\n";
$result = mail($to, $subject, $msg, $headers,
'-**********@mysi te.com');
I have also played around with setting all the headers to good
addresses at my site to see any bounces from the SMTP server.

Any advice greatly appreciated!!!

jg

Jun 16 '06 #1
6 2217
>My habitual use of mail() is causing me some grief. I am having
slightly different results depending on the server I use but the gist
is that mail() is returning 1, and I can send mail to yahoo.com,
gmail.com, and hotmail.com no problem. 100% success.
Directly putting values from $_POST[] into email headers without
checking them for the absence of carriage return or linefeed
characters WILL get you listed as a spammer because your page WILL
be abused by spammers. (applies to your FULL HEADERS, FULL HEADERS
PLUS, and I don't see the 4th way). If you see carriage returns
or linefields in any fields to be put in headers, you should not
send mail and tell the spammer to fuck off (but don't be so polite
about it).

You can expect that some servers will reject your message as SPAM
because:
- There is no From: line.
- The address on the From: line is invalid.
- The address on the From: line is not allowed to send mail from
anyplace but specific servers (SPF) and the recipient server is
enforcing it.
- You aren't on their whitelist.
- Some spammer abused a script on another site hosted by the same
web provider as you did 6 years ago, and you have the same IP address.

Gordon L. Burditt
Here are four ways I have tried this:

// NO HEADERS
$to = 's******@gmail. com';
$subject = "Inquiry from some.com";
$msg = 'whatever';
$result = mail($to, $subject, $msg);

// FULL HEADERS
$to = 's******@gmail. com';
$subject = "Inquiry from ENLA.com: $_POST[name] $_POST[company]";
$headers = "From: $_POST[name] <$_POST[email]>\r\n";
$headers .= "Reply-to: $_POST[name] <$_POST[email]>\r\n";
$headers .= "Return-Path: $_POST[name] <$_POST[email]>\r\n";
$headers .= "Message-ID: <" . date("YdmHis") .
".TheSystem@". $_SERVER['SERVER_NAME'].">" . "\r\n";
$headers .= "X-Mailer: PHP v". phpversion() . "\r\n";
$result = mail($to, $subject, $msg, $headers);

// FULL HEADERS PLUS -f FLAG to set the envelope sender address
$to = 's******@gmail. com';
$subject = "Inquiry from ENLA.com: $_POST[name] $_POST[company]";
$headers = "From: $_POST[name] <$_POST[email]>\r\n";
$headers .= "Reply-to: $_POST[name] <$_POST[email]>\r\n";
$headers .= "Return-Path: $_POST[name] <$_POST[email]>\r\n";
$headers .= "Message-ID: <" . date("YdmHis") .
".TheSystem@". $_SERVER['SERVER_NAME'].">" . "\r\n";
$headers .= "X-Mailer: PHP v". phpversion() . "\r\n";
$result = mail($to, $subject, $msg, $headers,
'-**********@mysi te.com');
I have also played around with setting all the headers to good
addresses at my site to see any bounces from the SMTP server.

Jun 16 '06 #2
Gordon,

Thank you for the reply. Your advice is sound practice but in my
opinion it doesn't address my difficulty.

The mail which fails to arrive is being sent under controlled
circumstances and with the exception of the No Headers version all
attempts have included a From: header. And, for this controlled
testing, I do know that there are no carriage returns in the values.

The emails were generated on four seperate severs not owned by the same
parent and hence IP blocks differed. The results however remained the
same even when hard coded values were used in the headers. Each server
could get it through to Gmail et al but none were getting it through to
the vhosted accounts. If it was an IP based block it certainly is very
broad.

Anyway, thanks for considering my problem!

jg

Additionally the address which the
Gordon Burditt wrote:
My habitual use of mail() is causing me some grief. I am having
slightly different results depending on the server I use but the gist
is that mail() is returning 1, and I can send mail to yahoo.com,
gmail.com, and hotmail.com no problem. 100% success.


Directly putting values from $_POST[] into email headers without
checking them for the absence of carriage return or linefeed
characters WILL get you listed as a spammer because your page WILL
be abused by spammers. (applies to your FULL HEADERS, FULL HEADERS
PLUS, and I don't see the 4th way). If you see carriage returns
or linefields in any fields to be put in headers, you should not
send mail and tell the spammer to fuck off (but don't be so polite
about it).

You can expect that some servers will reject your message as SPAM
because:
- There is no From: line.
- The address on the From: line is invalid.
- The address on the From: line is not allowed to send mail from
anyplace but specific servers (SPF) and the recipient server is
enforcing it.
- You aren't on their whitelist.
- Some spammer abused a script on another site hosted by the same
web provider as you did 6 years ago, and you have the same IP address.

Gordon L. Burditt
Here are four ways I have tried this:

// NO HEADERS
$to = 's******@gmail. com';
$subject = "Inquiry from some.com";
$msg = 'whatever';
$result = mail($to, $subject, $msg);

// FULL HEADERS
$to = 's******@gmail. com';
$subject = "Inquiry from ENLA.com: $_POST[name] $_POST[company]";
$headers = "From: $_POST[name] <$_POST[email]>\r\n";
$headers .= "Reply-to: $_POST[name] <$_POST[email]>\r\n";
$headers .= "Return-Path: $_POST[name] <$_POST[email]>\r\n";
$headers .= "Message-ID: <" . date("YdmHis") .
".TheSystem@". $_SERVER['SERVER_NAME'].">" . "\r\n";
$headers .= "X-Mailer: PHP v". phpversion() . "\r\n";
$result = mail($to, $subject, $msg, $headers);

// FULL HEADERS PLUS -f FLAG to set the envelope sender address
$to = 's******@gmail. com';
$subject = "Inquiry from ENLA.com: $_POST[name] $_POST[company]";
$headers = "From: $_POST[name] <$_POST[email]>\r\n";
$headers .= "Reply-to: $_POST[name] <$_POST[email]>\r\n";
$headers .= "Return-Path: $_POST[name] <$_POST[email]>\r\n";
$headers .= "Message-ID: <" . date("YdmHis") .
".TheSystem@". $_SERVER['SERVER_NAME'].">" . "\r\n";
$headers .= "X-Mailer: PHP v". phpversion() . "\r\n";
$result = mail($to, $subject, $msg, $headers,
'-**********@mysi te.com');
I have also played around with setting all the headers to good
addresses at my site to see any bounces from the SMTP server.


Jun 16 '06 #3
>Thank you for the reply. Your advice is sound practice but in my
opinion it doesn't address my difficulty.

The mail which fails to arrive is being sent under controlled
circumstance s and with the exception of the No Headers version all
attempts have included a From: header.
If you send mail from PHP to the email address in the From: header,
is it *ACTUALLY DELIVERED*? Yes, the left hand side really counts.

If the domain in the From: line publishes an SPF record, is the
web site you're running PHP on listed in it?

Does the web site you're running PHP on have valid reverse DNS?
Some mail servers won't accept mail from servers with no reverse DNS.

Can you send email to a server you rent space on, have it fail,
and get the ISP to tell you WHY it failed? Or look at the server
logs yourself?

And, for this controlled
testing, I do know that there are no carriage returns in the values.
Don't put it in production like that. Spammers will abuse it.
But it shouldn't matter for your mail delivery problem.
The emails were generated on four seperate severs not owned by the same
parent and hence IP blocks differed. The results however remained the
same even when hard coded values were used in the headers. Each server
could get it through to Gmail et al but none were getting it through to
the vhosted accounts. If it was an IP based block it certainly is very
broad.


Gordon L. Burditt
Jun 16 '06 #4
Hi Gordon,

Thanks for the continued help!

AFAIK I have only used valid deliverable addresses as the FROM:. I
have been using my own addresses. I will definitely bear in mind that
it must be valid in future I had not been aware of that.

As for your other questions, I will pursue answers to those as well,
though I will probably get the admin to set up a mail account for the
script to use and switch to using Perl's Mail:Sender module under AUTH.
If problems persist then we can be pretty sure we have a blacklisting
issue I think.

Strange that in six years of using this method I have never been so
stymied by it before.

Anyway, I really do appreciate your time and advice!!

Peace,

jg

Gordon Burditt wrote:
Thank you for the reply. Your advice is sound practice but in my
opinion it doesn't address my difficulty.

The mail which fails to arrive is being sent under controlled
circumstance s and with the exception of the No Headers version all
attempts have included a From: header.


If you send mail from PHP to the email address in the From: header,
is it *ACTUALLY DELIVERED*? Yes, the left hand side really counts.

If the domain in the From: line publishes an SPF record, is the
web site you're running PHP on listed in it?

Does the web site you're running PHP on have valid reverse DNS?
Some mail servers won't accept mail from servers with no reverse DNS.

Can you send email to a server you rent space on, have it fail,
and get the ISP to tell you WHY it failed? Or look at the server
logs yourself?

And, for this controlled
testing, I do know that there are no carriage returns in the values.


Don't put it in production like that. Spammers will abuse it.
But it shouldn't matter for your mail delivery problem.
The emails were generated on four seperate severs not owned by the same
parent and hence IP blocks differed. The results however remained the
same even when hard coded values were used in the headers. Each server
could get it through to Gmail et al but none were getting it through to
the vhosted accounts. If it was an IP based block it certainly is very
broad.


Gordon L. Burditt


Jun 17 '06 #5
$subject = "Inquiry from ENLA.com: $_POST[name] $_POST[company]";

This is just a suggestion -

Try sending your test emails with the suject "test"

I have noticed some anti-virus-spam traps are now looking at the subject
line for things like ".com" and rejecting them as if they were looking at
executable files. (.com is a valid windows executable extension)

Also be careful what you put in those variables.

tony

ps... should "Inquiry" be "Enquiry" ?
Jun 17 '06 #6
jerrygarciuh wrote:
Hi folks,

HELP!!!!

My habitual use of mail() is causing me some grief. I am having
slightly different results depending on the server I use but the gist
is that mail() is returning 1, and I can send mail to yahoo.com,
gmail.com, and hotmail.com no problem. 100% success. <snip> I have also played around with setting all the headers to good
addresses at my site to see any bounces from the SMTP server.


IIRC, there was/is some problem with mail() function and when the
receiving server is too sensitive, it will throw syntax error and the
e-mail will get bounced (eg. Yahoo). But, since you're saying that you
could send to yahoo.com, it is better that you check for any bounced
mails and reasons.

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Jun 18 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
52094
by: Pierre Jelenc | last post by:
I use mail() for a musician's mailing list script that suddenly started having problems after many months of working flawlessly. The code fragment is: if (mail($To,$Subject,$Body,$Headers,$Param)) { print("The message was sent to:<p>$HTML_BCC<br><hr><h3>Completed OK</h3><p>\n"); } else
12
2821
by: Chris Dewin | last post by:
Hi. I've been thinking about using smtplib to run a mailing list from my website. s = smtplib.SMTP("server") s.sendmail(fromaddress, toaddresess, msg) I know that in this instance, the toaddresses variable can be a variable of type list. Suppose the list contains well over 100 emails. Would that create some sort of drain on the mail server? Would I be better off doing it in some
2
11587
by: TomSoCal | last post by:
I have an Access Database of about 400 records, most records have a character field with an e-mail address for the person in that record. How can I use these addresses to create a group mailing to all these people via Outlook Express, or Outlook 2002?? Tom
1
5271
by: cemcat | last post by:
Hello, We have an ASP.NET 2.0 (C#) web form that contains a textbox for users to enter multiple e-mail addresses separated by semicolons. We need to validate that each individual e-mail address entered is a valid e-mail address format. We've added a CustomValidator to perform this validation. We have the server-side validation working fine, but now we need to add some client-side validation via JavaScript. We are having difficulties...
39
3325
by: Viken Karaguesian | last post by:
Hello all, <SIGH> I'm soooooo sick and tired of getting spam e-mails. I'm sure that part of the reson for this is that my e-mail address is publicly available on my website, ready to be picked by e-mail harvesting programs. I tried to thwart them by adding a REMOVE_THIS in my e-mail address (username@REMOVE_THISispname.net), but the e-mails have not stopped. As for NG's, I have the return address blocked in a similar fashion.
34
18271
by: antonyliu2002 | last post by:
I've set up the virtual smtp server on my IIS 5.1 like so: 1. Assign IP address to "All Unassigned", and listen to port 25. 2. Access Connection granted to "127.0.0.1". 3. Relay only allow "127.0.0.1". 4. Authentication: "Anonymous access" only. 5. Outbound connection listen to TCP 25. Besides,
10
1682
by: Newbie | last post by:
Hi all, I'm looking for a way to send newsletter to my subscribers (1000+ in total). I've managed to do it using .NET system.net.mail.smtpclient's sendAsync. I read the email addresses from a table (in a MSSQL DB) using sqldatareader, then looping through it to read each email address and add it to the instance's 'TO' property (e.g: mail.to.add(r.item("email_addr")) ). I test run it with my own addresses to see how it works. And...
4
3265
by: NielsM | last post by:
Hello all, I have a table (tblExport03) with the following fields: ID : autonumber Title : text FirstName : text LastName : text OrganisationName : text BusinessEmailAddres : text (isNull, @ or valid e-mail address)
7
9839
by: undbund | last post by:
Hi I am creating a newsletter system. The software should run from desktop computer (localhost) but be able to send email to anyone on the internet. Can you guys give me some ideas on how to achieve this. Thanks
0
9641
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10146
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10080
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9944
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.