Click here to get back home

Sending mail with mail() without header

 HomeNewsGroups | Search | About
 comp.lang.php    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Sending mail with mail() without header Sebzzz 07-27-2008
Get Chitika Premium
Posted by Sebzzz on July 27, 2008, 9:36 pm
Please log in for more thread options
Hi,

I'm working on a website where there is a from from which I want to
send the data by e-mail.

When I send myself the result with mail($my_email, $title, $message)
everything works fine and I receive a plain text email. However, the
people for which I'm doing the site receive some kind of error when I
do the same thing but delivered to them > mail($their_email, $title,
$message)

The error looks something like this:

Your message cannot be delivered to the following recipients:

Recipient address: services@theirdomain.com
Reason: Illegal host/domain name found

I also used something like this in the script to make it work when
sending it to myself:

ini_set('SMTP', 'mail.theirdomain.com');
ini_set('sendmail_from', 'services@theirdomain.com');

Is it the fact that I send this email in plain text with no headers
that could trigger some sort of spam filtering?

If so, what headers should I be using?

Thanks in advance

Posted by Twayne on July 28, 2008, 11:26 am
Please log in for more thread options
> Hi,
>
> I'm working on a website where there is a from from which I want to
> send the data by e-mail.
>
> When I send myself the result with mail($my_email, $title, $message)
> everything works fine and I receive a plain text email. However, the
> people for which I'm doing the site receive some kind of error when I
> do the same thing but delivered to them > mail($their_email, $title,
> $message)
>
> The error looks something like this:
>
> Your message cannot be delivered to the following recipients:
>
> Recipient address: services@theirdomain.com
> Reason: Illegal host/domain name found
>
> I also used something like this in the script to make it work when
> sending it to myself:
>
> ini_set('SMTP', 'mail.theirdomain.com');
> ini_set('sendmail_from', 'services@theirdomain.com');
>
> Is it the fact that I send this email in plain text with no headers
> that could trigger some sort of spam filtering?
>
> If so, what headers should I be using?
>
> Thanks in advance

I can't give a lot of detail, but it's because the Headers are non-RFC
compliant, I imagine. Without the envelope "from" and "return path"
etc. many ISPs will reject the mail. I imagine someone who can give you
specific details will be along shortly.

HTH



Posted by Sebzzz on July 28, 2008, 1:33 pm
Please log in for more thread options
Thanks for this piece of info.

It helps to know where the problem comes from.

> > Hi,
>
> > I'm working on a website where there is a from from which I want to
> > send the data by e-mail.
>
> > When I send myself the result with mail($my_email, $title, $message)
> > everything works fine and I receive a plain text email. However, the
> > people for which I'm doing the site receive some kind of error when I
> > do the same thing but delivered to them > mail($their_email, $title,
> > $message)
>
> > The error looks something like this:
>
> > Your message cannot be delivered to the following recipients:
>
> > =A0Recipient address: servi...@theirdomain.com
> > =A0Reason: Illegal host/domain name found
>
> > I also used something like this in the script to make it work when
> > sending it to myself:
>
> > =A0 =A0ini_set('SMTP', 'mail.theirdomain.com');
> > =A0 =A0ini_set('sendmail_from', 'servi...@theirdomain.com');
>
> > Is it the fact that I send this email in plain text with no headers
> > that could trigger some sort of spam filtering?
>
> > If so, what headers should I be using?
>
> > Thanks in advance
>
> I can't give a lot of detail, but it's because the Headers are non-RFC
> compliant, I imagine. =A0Without the envelope "from" and "return path"
> etc. many ISPs will reject the mail. =A0I imagine someone who can give yo=
u
> specific details will be along shortly.
>
> HTH


Posted by Twayne on July 28, 2008, 2:13 pm
Please log in for more thread options
> Thanks for this piece of info.
>
> It helps to know where the problem comes from.
>
>>> Hi,
>>
>>> I'm working on a website where there is a from from which I want to
>>> send the data by e-mail.
>>
>>> When I send myself the result with mail($my_email, $title, $message)
>>> everything works fine and I receive a plain text email. However, the
>>> people for which I'm doing the site receive some kind of error when
>>> I do the same thing but delivered to them > mail($their_email,
>>> $title, $message)
>>
>>> The error looks something like this:
>>
>>> Your message cannot be delivered to the following recipients:
>>
>>> Recipient address: servi...@theirdomain.com
>>> Reason: Illegal host/domain name found
>>
>>> I also used something like this in the script to make it work when
>>> sending it to myself:
>>
>>> ini_set('SMTP', 'mail.theirdomain.com');
>>> ini_set('sendmail_from', 'servi...@theirdomain.com');
>>
>>> Is it the fact that I send this email in plain text with no headers
>>> that could trigger some sort of spam filtering?
>>
>>> If so, what headers should I be using?
>>
>>> Thanks in advance
>>
>> I can't give a lot of detail, but it's because the Headers are
>> non-RFC compliant, I imagine. Without the envelope "from" and
>> "return path" etc. many ISPs will reject the mail. I imagine someone
>> who can give you specific details will be along shortly.
>>
>> HTH

Well, since no one else has come along yet I'll give you what little I
know from my meager experience:
You have to have From. Not the From that prints for the recipient, but
the From header in the envelope.
I think the Return Path is derived from that.

You need to identify the content type. e.g. texp/plain, etc.

Then the doctype, and etc. etc.. PHPNet and W3 schools both have good
articles on them; I'd do some checking there to get going if this is new
to you. Basically you have a set of requireds and then a set of "if you
wanna" types of headers.

I'm new at this too so getting too specific would be the blind leading
the blind <g>.

HTH

Twayne



Posted by The Hajj on July 28, 2008, 6:24 pm
Please log in for more thread options
You don't have to set headers if you ini is set properly, even though
I've never had to set anything in my ini for my mail scripts. I do now
however format the headers properly... excerpt from ini


[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = me@example.com

; For Unix only. You may supply arguments as well (default: "sendmail
-t -i").
;sendmail_path =

What are they using for mail? What OS is php running from? If it's
winders check to see if they have the smtp relay open, if not (more
than likely) have the admin add the server to allow it to relay, I
don't remember where it's at off the top of my head as my server admin
hat has a bit of dust one it.

When using headers use similar to this format $header .= "From:
$webmaster" . "\r\n"; . The last part is important, Google for more
info

Similar ThreadsPosted
php mail() not sending to mail Clients (ie, Outlook, Apple Mail, thunderbird, etc..) November 29, 2007, 10:19 pm
mail form not sending mail - server2003 March 16, 2005, 9:00 am
i am getting error while sending mail using mail() function April 6, 2005, 3:35 am
mail() function doesn't seem to be sending MAIL FROM: properly June 27, 2005, 4:16 pm
sending mail otherthan mail() May 27, 2005, 4:00 am
Sending mail September 14, 2004, 2:52 pm
Sending Mail September 15, 2004, 11:44 am
php not sending mail September 27, 2007, 12:34 am
Problem in sending mail July 27, 2004, 6:13 am
Sending mail with an attachment August 8, 2005, 1:00 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap