Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

reply-to

1 view
Skip to first unread message

Dave

unread,
Dec 23, 2009, 11:16:07 AM12/23/09
to
Gang,

I'm attempting to send an email using php's mail() function with
a Gmail "Announcement-only" group and a "Reply-To" header. I have all
of that setup correctly, but the reply to address appends the servers
FQDN to the address (ie reci...@domain.com@server.ispdomain.com).
I've figured out that it deals with a sender envelope issue, so for
the 5th parameter I've passed "-f re...@domain.com -r
re...@domain.com". The 're...@domain.com' is the address that I would
like to have users reply to. Am I missing something?

Also, I'm using an "Announcement-only" group and a "Reply-To"
header because I don't want peoples replies to announcements to go to
the whole group, but rather an defined group of people. Is there an
easier way to handle this than what I'm currently doing?

Thanks,
Dave

"Álvaro G. Vicario"

unread,
Dec 23, 2009, 12:42:46 PM12/23/09
to
El 23/12/2009 17:16, Dave escribi�:

> I'm attempting to send an email using php's mail() function with
> a Gmail "Announcement-only" group and a "Reply-To" header. I have all
> of that setup correctly, but the reply to address appends the servers
> FQDN to the address (ie reci...@domain.com@server.ispdomain.com).
> I've figured out that it deals with a sender envelope issue, so for
> the 5th parameter I've passed "-f re...@domain.com -r
> re...@domain.com". The 're...@domain.com' is the address that I would
> like to have users reply to. Am I missing something?

Well, you are missing posting some code here... The most obvious reason
is typing an address with invalid format. The -f option sets the
return-path address (i.e., the actual sender) which is pretty unrelated.


> Also, I'm using an "Announcement-only" group and a "Reply-To"
> header because I don't want peoples replies to announcements to go to
> the whole group, but rather an defined group of people. Is there an
> easier way to handle this than what I'm currently doing?

That's what the "Reply-To" header is good for.


--
-- http://alvaro.es - �lvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programaci�n web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--

Peter H. Coffin

unread,
Dec 23, 2009, 2:36:55 PM12/23/09
to
On Wed, 23 Dec 2009 18:42:46 +0100, �lvaro G. Vicario wrote:
> El 23/12/2009 17:16, Dave escribi�:
>> I'm attempting to send an email using php's mail() function with
>> a Gmail "Announcement-only" group and a "Reply-To" header. I have all
>> of that setup correctly, but the reply to address appends the servers
>> FQDN to the address (ie reci...@domain.com@server.ispdomain.com).
>> I've figured out that it deals with a sender envelope issue, so for
>> the 5th parameter I've passed "-f re...@domain.com -r
>> re...@domain.com". The 're...@domain.com' is the address that I would
>> like to have users reply to. Am I missing something?
>
> Well, you are missing posting some code here... The most obvious reason
> is typing an address with invalid format. The -f option sets the
> return-path address (i.e., the actual sender) which is pretty unrelated.
>
>
>> Also, I'm using an "Announcement-only" group and a "Reply-To"
>> header because I don't want peoples replies to announcements to go to
>> the whole group, but rather an defined group of people. Is there an
>> easier way to handle this than what I'm currently doing?
>
> That's what the "Reply-To" header is good for.

I've got a *suspicion* that this is ... being manipulated by gmail. I'm
imagining this as mailing list that has archiving and a limited list of
email addresses allowed to actually post to the list. (Yeah, my mailman
experience is showing a bit...) So, php generates email, attaches the
right reply-to, sends email off to gmail to get reflected to the
subscribers, and gmail re-munges the address.

--
49. If I learn the whereabouts of the one artifact which can destroy
me, I will not send all my troops out to seize it. Instead I will
send them out to seize something else and quietly put a want-ad in
the local paper. --Peter Anspach's Evil Overlord list

Dave

unread,
Dec 23, 2009, 4:35:23 PM12/23/09
to
On Dec 23, 12:42 pm, "Álvaro G. Vicario"
<alvaro.NOSPAMTH...@demogracia.com.invalid> wrote:

> El 23/12/2009 17:16, Dave escribió:
>
> >       I'm attempting to send an email using php's mail() function with
> > a Gmail "Announcement-only" group and a "Reply-To" header.  I have all
> > of that setup correctly, but the reply to address appends the servers
> > FQDN to the address (ie recipi...@domain.com@server.ispdomain.com).

> > I've figured out that it deals with a sender envelope issue, so for
> > the 5th parameter I've passed "-f re...@domain.com -r
> > re...@domain.com".  The 're...@domain.com' is the address that I would
> > like to have users reply to.  Am I missing something?
>
> Well, you are missing posting some code here... The most obvious reason
> is typing an address with invalid format. The -f option sets the
> return-path address (i.e., the actual sender) which is pretty unrelated.
>

Opps! You're right! Here is the function that calls mail():

function send() {
$mime = "";
if ($this->from == 'user...@domain.org') {
# if ($this->from == 're...@domain.org') {
# $mime .= "From: reply\@domain.org\r\n";
# $mime .= "From: username\@domain.org\r\n";
$mime .= "From: ".$this->from. "\n";
$mime .= "Reply-To: reply\@domain.org\n";
} else if (! empty($this->from)) { $mime .= "From: ".$this->from.
"\n"; }
if (! empty($this->cc)) { $mime .= "Cc: ".$this->cc. "\n"; }
if (! empty($this->bcc)) { $mime .= "Bcc: ".$this->bcc.
"\n"; }
if (! empty($this->headers)) { $mime .= $this->headers. "\n"; }
if (! empty($this->body)) { $this->add_attachment($this-
>body,"","text/html"); }
$mime .= "MIME-Version: 1.0\n".$this->build_multipart();

return(mail($this->to,$this->subject,"",$mime,'-f domain.org -r
domain.org'));
# return(mail($this->to,$this->subject,"",$mime,'-f re...@domain.org
-r re...@domain.org') );
}
}

NOTE:
The commented out sections are other attempts at getting it work
correctly. Also, the values are assigned in other functions.

> >       Also, I'm using an "Announcement-only" group and a "Reply-To"
> > header because I don't want peoples replies to announcements to go to
> > the whole group, but rather an defined group of people.  Is there an
> > easier way to handle this than what I'm currently doing?
>
> That's what the "Reply-To" header is good for.
>
> --

> --http://alvaro.es- Álvaro G. Vicario - Burgos, Spain
> -- Mi sitio sobre programación web:http://borrame.com


> -- Mi web de humor satinado:http://www.demogracia.com
> --

Thats what I figured, I just can't get it to work. Any help would
greatly be appreciated!

Thanks,
Dave

Beauregard T. Shagnasty

unread,
Dec 23, 2009, 5:21:48 PM12/23/09
to
Peter H. Coffin wrote:

> .. So, php generates email, attaches the right reply-to, sends email


> off to gmail to get reflected to the subscribers, and gmail re-munges
> the address.

What does gmail have to do with using the PHP mail() function?

Put your subscribers' addresses directly (one email at a time) in the
TO: field, or if not many, all at once in the BCC: header.

--
-bts
-Four wheels carry the body; two wheels move the soul

Dave

unread,
Dec 23, 2009, 5:58:51 PM12/23/09
to
On Dec 23, 5:21 pm, "Beauregard T. Shagnasty"

Because this is an announcement list. Why manually email hundreds of
people one at a time when I can most likely get this scripted? And to
do that for every announcement, you're talking about having to hire a
full time staff member! No thanks... :)

Regarding Gmail's involvement with PHP mail()... well, they're the
email server thats processing the requests. If they are stripping
headers or altering them, I'll have another delimma to face.

Hope this helps!

Dave

Doug Miller

unread,
Dec 23, 2009, 7:58:16 PM12/23/09
to
In article <2323ae44-8601-427d...@a6g2000yqm.googlegroups.com>, Dave <hend...@gmail.com> wrote:
>On Dec 23, 5:21=A0pm, "Beauregard T. Shagnasty"

><a.nony.m...@example.invalid> wrote:
>> Peter H. Coffin wrote:
>> > .. So, php generates email, attaches the right reply-to, sends email
>> > off to gmail to get reflected to the subscribers, and gmail re-munges
>> > the address.
>>
>> What does gmail have to do with using the PHP mail() function?
>>
>> Put your subscribers' addresses directly (one email at a time) in the
>> TO: field, or if not many, all at once in the BCC: header.
>>
>
>Because this is an announcement list. Why manually email hundreds of
>people one at a time when I can most likely get this scripted? And to
>do that for every announcement, you're talking about having to hire a
>full time staff member! No thanks... :)

I imagine he meant for you to have your *script* send the messages
individually, one per recipient, rather than one message to a list. :-)

Beauregard T. Shagnasty

unread,
Dec 23, 2009, 8:48:55 PM12/23/09
to
Dave wrote:

> "Beauregard T. Shagnasty" wrote:
>> Peter H. Coffin wrote:
>>> .. So, php generates email, attaches the right reply-to, sends email
>>> off to gmail to get reflected to the subscribers, and gmail re-munges
>>> the address.
>>
>> What does gmail have to do with using the PHP mail() function?
>>
>> Put your subscribers' addresses directly (one email at a time) in the
>> TO: field, or if not many, all at once in the BCC: header.

[please instruct your 'newsreader' to strip signatures]

> Because this is an announcement list. Why manually email hundreds of
> people one at a time when I can most likely get this scripted? And
> to do that for every announcement, you're talking about having to
> hire a full time staff member! No thanks... :)

Umm, how else would you be using a PHP mail() function if not in a
script? Do you have a database of the prospective recipients? If so,
it would be about a 20-line script...

> Regarding Gmail's involvement with PHP mail()... well, they're the
> email server thats processing the requests. If they are stripping
> headers or altering them, I'll have another delimma to face.

Still doesn't make sense. Gmail is not a PHP server. I'd assumed you
were using your web server and running PHP there. Your web host should
be able to send the mail. That's easy; I do it all the time, using
either individual TO: addresses (in a loop), or a hundred or more in the
BCC: field.

> Hope this helps!

Not so much.

(Yes, Doug. You're right. One script; many email messages. <g>)

Greg Russell

unread,
Dec 23, 2009, 11:32:33 PM12/23/09
to
In news:hguha7$d2o$1...@news.eternal-september.org,
Beauregard T. Shagnasty <a.non...@example.invalid> typed:

> [please instruct your 'newsreader' to strip signatures]

Look in the mirror, the problem lies not only in *your* signature, but
"Dave" 's failure to adequately trim the cruft you created..

"-- " (2 hyphens, a space, a newline) is a proper sig delimiter.
"-- " isn't ... fix *your* sig delimiter before barking at others, please.


Beauregard T. Shagnasty

unread,
Dec 23, 2009, 11:44:26 PM12/23/09
to
Greg Russell wrote:

> Beauregard T. Shagnasty typed:


>> [please instruct your 'newsreader' to strip signatures]
>
> Look in the mirror, the problem lies not only in *your* signature, but
> "Dave" 's failure to adequately trim the cruft you created..
>
> "-- " (2 hyphens, a space, a newline) is a proper sig delimiter.

..as I am well aware.

> "-- " isn't ... fix *your* sig delimiter before barking at others,
> please.

Begging your pardon, kind sir, but my sig delimiter has only one space,
as is the standard. Perhaps *your* newsreader (a rather inept one) is
messing it up.

Peter H. Coffin

unread,
Dec 23, 2009, 11:38:34 PM12/23/09
to

Irksome to do it that way, for non-topical reasons. Elaboration as to
why it's bad upon request.

--
34. I will not turn into a snake. It never helps.
--Peter Anspach's list of things to do as an Evil Overlord

Peter H. Coffin

unread,
Dec 23, 2009, 11:40:57 PM12/23/09
to

It seems obvious to me: Dave's sending one PHP-generated email to a
mailing-list engine run by gmail to handle the propagation. (This is
*AMAZINGLY* more sensible than trying to manage a mailing list in
homegrown PHP, for many, many reasons.)

Beauregard T. Shagnasty

unread,
Dec 24, 2009, 12:17:11 AM12/24/09
to
Peter H. Coffin wrote:

Doesn't seem that way to me. I feel that having a MySQL table with the
addresses and a 20-line script would be easier to maintain.

Greg Russell

unread,
Dec 24, 2009, 12:25:47 AM12/24/09
to
On Wed, 23 Dec 2009 23:44:26 -0500, Beauregard T. Shagnasty wrote:

>> "-- " (2 hyphens, a space, a newline) is a proper sig delimiter.
>
> ..as I am well aware.
>
>> "-- " isn't ... fix *your* sig delimiter before barking at others,
>> please.
>
> Begging your pardon, kind sir, but my sig delimiter has only one space,
> as is the standard. Perhaps *your* newsreader (a rather inept one) is
> messing it up.

It then begs the question: Why does it "mess up" yours and not others?

Gordon Burditt

unread,
Dec 24, 2009, 1:14:09 AM12/24/09
to
> I'm attempting to send an email using php's mail() function with
>a Gmail "Announcement-only" group and a "Reply-To" header. I have all
>of that setup correctly, but the reply to address appends the servers
>FQDN to the address (ie reci...@domain.com@server.ispdomain.com).
>I've figured out that it deals with a sender envelope issue, so for
>the 5th parameter I've passed "-f re...@domain.com -r
>re...@domain.com". The 're...@domain.com' is the address that I would
>like to have users reply to. Am I missing something?

Is this a hosted setup?

The -f option is typically passed to sendmail or whatever mail
transport is in use. Using the -f option requires privileges you
may not have. It may be that if you specify the -f option, it
*must* refer to an address on the local host (which might be an
alias that points elsewhere), and if not, it will be fixed for you.

The -r flag is described as an alternate and obsolete form of the
-f flag. I'm not sure what will happen if you specify both -f and
-r.

Message has been deleted

Beauregard T. Shagnasty

unread,
Dec 24, 2009, 7:33:16 AM12/24/09
to
Greg Russell wrote:

> Beauregard T. Shagnasty wrote:
>> [greg russell wrote:]


>>> "-- " (2 hyphens, a space, a newline) is a proper sig delimiter.
>>
>> ..as I am well aware.
>>
>>> "-- " isn't ... fix *your* sig delimiter before barking at others,
>>> please.
>>
>> Begging your pardon, kind sir, but my sig delimiter has only one space,
>> as is the standard. Perhaps *your* newsreader (a rather inept one) is
>> messing it up.
>
> It then begs the question: Why does it "mess up" yours and not others?

As I am not looking over your shoulder, I can't say. Looking at the raw
source of my posts (in multiple readers), I see only one space.

I see you've switched newsreaders from OE to Pan. So will I in this post.

There is only one space in the following sig delimiter. Does anyone other
than Greg see two spaces in any of my posts?

Jerry Stuckle

unread,
Dec 24, 2009, 8:09:44 AM12/24/09
to

His sig separator is fine here. Check your newsreader.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstu...@attglobal.net
==================

Dave

unread,
Dec 24, 2009, 8:11:15 AM12/24/09
to
On Dec 23, 7:58 pm, spamb...@milmac.com (Doug Miller) wrote:

That would make more sense. :)

Dave

unread,
Dec 24, 2009, 8:15:56 AM12/24/09
to


You are correct.

Dave

unread,
Dec 24, 2009, 8:16:51 AM12/24/09
to
On Dec 24, 12:17 am, "Beauregard T. Shagnasty"

To each his own I suppose... :) I would rather let Gmail manage the
mailing list.

Dave

unread,
Dec 24, 2009, 8:28:45 AM12/24/09
to
On Dec 24, 1:14 am, gordonb.60...@burditt.org (Gordon Burditt) wrote:
> >     I'm attempting to send an email using php's mail() function with
> >a Gmail "Announcement-only" group and a "Reply-To" header.  I have all
> >of that setup correctly, but the reply to address appends the servers
> >FQDN to the address (ie recipi...@domain.com@server.ispdomain.com).

> >I've figured out that it deals with a sender envelope issue, so for
> >the 5th parameter I've passed "-f re...@domain.com -r
> >re...@domain.com".  The 're...@domain.com' is the address that I would
> >like to have users reply to.  Am I missing something?
>
> Is this a hosted setup?
>
> The -f option is typically passed to sendmail or whatever mail
> transport is in use.  Using the -f option requires privileges you
> may not have.  It may be that if you specify the -f option, it
> *must* refer to an address on the local host (which might be an
> alias that points elsewhere), and if not, it will be fixed for you.
>
> The -r flag is described as an alternate and obsolete form of the
> -f flag.  I'm not sure what will happen if you specify both -f and
> -r.
>
> >     Also, I'm using an "Announcement-only" group and a "Reply-To"
> >header because I don't want peoples replies to announcements to go to
> >the whole group, but rather an defined group of people.  Is there an
> >easier way to handle this than what I'm currently doing?
>
>

Yes it is a hosted setup. Thanks for the info on the -f and -r
usage. I have removed the -r syntax. Would there be a way to find
out if I do have permissions to use the -f flag? Also, I tried using
my account on the server as the value to -f, but it didn't work
either. Previously, I was using the email address of the "Reply-To".

Sherm Pendley

unread,
Dec 24, 2009, 9:13:10 AM12/24/09
to
"Beauregard T. Shagnasty" <a.non...@example.invalid> writes:

> There is only one space in the following sig delimiter. Does anyone other
> than Greg see two spaces in any of my posts?

I don't, and gnus correctly removed your .sig for me.

sherm--

Beauregard T. Shagnasty

unread,
Dec 24, 2009, 10:03:34 AM12/24/09
to
Sherm Pendley wrote:

> "Beauregard T. Shagnasty" writes:
>> There is only one space in the following sig delimiter. Does anyone
>> other than Greg see two spaces in any of my posts?
>
> I don't, and gnus correctly removed your .sig for me.

Thanks, guys. Perhaps this information could give Greg an opportunity
to check his newsreaders for faults.

Just for fun, here is a manually entered delimiter with two spaces:
--

..and the regular reader-inserted sig follows:

The Natural Philosopher

unread,
Dec 24, 2009, 11:00:39 AM12/24/09
to
Beauregard T. Shagnasty wrote:
> Sherm Pendley wrote:
>
>> "Beauregard T. Shagnasty" writes:
>>> There is only one space in the following sig delimiter. Does anyone
>>> other than Greg see two spaces in any of my posts?
>> I don't, and gnus correctly removed your .sig for me.
>
> Thanks, guys. Perhaps this information could give Greg an opportunity
> to check his newsreaders for faults.
>
> Just for fun, here is a manually entered delimiter with two spaces:
> --
>
> ..and the regular reader-inserted sig follows:
>
guess which one doesn't work.

Dave

unread,
Dec 24, 2009, 11:38:39 AM12/24/09
to
On Dec 24, 11:00 am, The Natural Philosopher <t...@invalid.invalid>
wrote:


I know you guys are working on getting the signature "fixed", but I
don't want this thread to loose site of the OP. Does anyone have any
other advice, suggestions, and/or code to help out with that?

Beauregard T. Shagnasty

unread,
Dec 24, 2009, 11:51:21 AM12/24/09
to
The Natural Philosopher wrote:

> Beauregard T. Shagnasty wrote:
>> ...


>> Just for fun, here is a manually entered delimiter with two spaces:
>> --
>>
>> ..and the regular reader-inserted sig follows:
>>
> guess which one doesn't work.

Heh, not hard to do that, eh? Thanks for testing. I suppose we can end
this sub-thread - unless Greg wants to delve further...

Sherm Pendley

unread,
Dec 24, 2009, 12:44:15 PM12/24/09
to
"Beauregard T. Shagnasty" <a.non...@example.invalid> writes:

> Sherm Pendley wrote:
>
>> "Beauregard T. Shagnasty" writes:
>>> There is only one space in the following sig delimiter. Does anyone
>>> other than Greg see two spaces in any of my posts?
>>
>> I don't, and gnus correctly removed your .sig for me.
>
> Thanks, guys. Perhaps this information could give Greg an opportunity
> to check his newsreaders for faults.
>
> Just for fun, here is a manually entered delimiter with two spaces:
> --
>
> ..and the regular reader-inserted sig follows:

Works just as expected for me.

sherm--

Sherm Pendley

unread,
Dec 24, 2009, 12:46:51 PM12/24/09
to
Dave <hend...@gmail.com> writes:

> I don't want this thread to loose site of the OP.

This is usenet. Stop wanting that, or live with disappointment on a
daily basis - your choice. ;-)

sherm--

Peter H. Coffin

unread,
Dec 24, 2009, 12:34:11 PM12/24/09
to

> You are correct.

I'd recommend seeing if gmail/googlegroups/whatever can be configured to
do what you want, then, since I suspect that's what's messing it up. The
mailman package houghi mentioned (a tool I also use) has all the
controls for who can post, where mail goes when it comes back or is
replied to inside the tool itself and it rewrites all the headers
according to the configuration of the mailing list. The Google thing may
also do that.

--
100. Finally, to keep my subjects permanently locked in a mindless
trance, I will provide each of them with free unlimited Internet
access.

Doug Miller

unread,
Dec 24, 2009, 2:54:32 PM12/24/09
to

And the reason it doesn't work is that there should be only one space. The
correct sequence is hyphen, hyphen, space, newline.

Dave

unread,
Dec 24, 2009, 5:35:57 PM12/24/09
to
On Dec 24, 12:46 pm, Sherm Pendley <spamt...@shermpendley.com> wrote:

lol thanks for the words of encouragement! :)

Curtis Dyer

unread,
Dec 24, 2009, 8:26:21 PM12/24/09
to

Beauregard T. Shagnasty's .sig is also removed as expected on Xnews.

--
Curtis Dyer
<? $x='<? $x=%c%s%c;printf($x,39,$x,39);?>';printf($x,39,$x,39);?>

"Álvaro G. Vicario"

unread,
Dec 28, 2009, 3:43:43 AM12/28/09
to
El 23/12/2009 22:35, Dave escribi�:
> On Dec 23, 12:42 pm, "�lvaro G. Vicario"
> <alvaro.NOSPAMTH...@demogracia.com.invalid> wrote:
>> El 23/12/2009 17:16, Dave escribi�:

>>
>>> I'm attempting to send an email using php's mail() function with
>>> a Gmail "Announcement-only" group and a "Reply-To" header. I have all
>>> of that setup correctly, but the reply to address appends the servers
>>> FQDN to the address (ie recipi...@domain.com@server.ispdomain.com).
>>> I've figured out that it deals with a sender envelope issue, so for
>>> the 5th parameter I've passed "-f re...@domain.com -r
>>> re...@domain.com". The 're...@domain.com' is the address that I would
>>> like to have users reply to. Am I missing something?
>>
>> Well, you are missing posting some code here... The most obvious reason
>> is typing an address with invalid format. The -f option sets the
>> return-path address (i.e., the actual sender) which is pretty unrelated.
>>
>
> Opps! You're right! Here is the function that calls mail():
>
> function send() {
> $mime = "";
> if ($this->from == 'user...@domain.org') {
> # if ($this->from == 're...@domain.org') {
> # $mime .= "From: reply\@domain.org\r\n";
> # $mime .= "From: username\@domain.org\r\n";
> $mime .= "From: ".$this->from. "\n";
> $mime .= "Reply-To: reply\@domain.org\n";

Is the "\" symbol part of the e-mail address?


> } else if (! empty($this->from)) { $mime .= "From: ".$this->from.
> "\n"; }
> if (! empty($this->cc)) { $mime .= "Cc: ".$this->cc. "\n"; }
> if (! empty($this->bcc)) { $mime .= "Bcc: ".$this->bcc.
> "\n"; }
> if (! empty($this->headers)) { $mime .= $this->headers. "\n"; }
> if (! empty($this->body)) { $this->add_attachment($this-
>> body,"","text/html"); }
> $mime .= "MIME-Version: 1.0\n".$this->build_multipart();
>
> return(mail($this->to,$this->subject,"",$mime,'-f domain.org -r
> domain.org'));
> # return(mail($this->to,$this->subject,"",$mime,'-f re...@domain.org
> -r re...@domain.org') );
> }
> }
>
> NOTE:
> The commented out sections are other attempts at getting it work
> correctly. Also, the values are assigned in other functions.

--
-- http://alvaro.es - �lvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programaci�n web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--

Dave

unread,
Jan 4, 2010, 8:48:00 AM1/4/10
to
On Dec 24 2009, 12:34 pm, "Peter H. Coffin" <hell...@ninehells.com>


I hope everyone had a pleasant set of holidays! Back to the grind...

I have looked at the Google service configuration without any luck to
see anything on specifying a "Reply-To" email address. Their website
is pretty basic in that respect. Also, the domain of the hosting
company is being appended to the email address, not anything from
Google which leads me to believe that its a problem on their end. Any
other ideas?

Dave

The Natural Philosopher

unread,
Jan 4, 2010, 10:30:12 AM1/4/10
to

If its a *nix host, and you have proper control over mail you need to
properly set the sender ENVELOPE address.

thats mail -f stuff.

Here is what works for me

It mails an attachment as well as a message body..

function mail_pdf_file($email, $subject,$from,$return_path,$body,$filename)
{
global $pdf;
$buf=PDF_get_buffer($pdf);
$attach=chunk_split( base64_encode($buf));
$boundary = md5( time() );
$headers = sprintf("From: %s\nMIME-Version: 1.0\nContent-Type:
multipart/related; boundary=\"%s\"",
$from, $boundary);
$message = sprintf("--%s\nContent-Type: text/plain;
charset=\"iso-9959-1\"\nContent-Transfer-Encoding:
7bit\n\n%s\n\n--%s\nContent-Type: application/pdf;
name=\"%s\"\nContent-Disposition: attachment;
filename=\"%s\"\nContent-Transfer-Encoding: base64\n\n%s\n\n--%s--\n",
$boundary,$body,$boundary,$filename, $filename,$attach,$boundary);
mail($email, $subject, $message, $headers, "-f ".$return_path );
}


The key thing is the -f return path bit.

If you don't set that, MOST mail transfer agents will patch that to
something like 'web-...@hostingdomain.com

Its the thing that represents the ultimate BOUNCE address ans is used in
te SMTP convresation which is spomething like

500 SMTP SERVER AT BLAT.COM
HELO
500 OK
MAIL FROM web-...@bollocks.com
666 MAIL REJECTED YOU SPAMMING Cnut


whereas if you do MAIL FROM webm...@mydomain.com, it may be happier.

The issue there is whether your ISP allows the -f switch to work.

AND the mail relays they talk to allow that as a valid envelope adress.

You should understand that the next part of the mail conversation is a
series of

RCPT TO smamt...@somewhere.com

type messages: These may be totally irrespective of the actual headers
To: and From: or indeed Reply-to:

Indeed the whole POINT of BCC, is that you can set an envelope address
that gets stripped from the headers.


In short, MTAS respond to the envelope from and to, and what's in the
headers is really there for humans or MUAs to mess with.


Hence the convention of calling those the NOT envelope address parts.
They are to an extent preserved inviolate, where the MTAS will make
routing decisions and bounce decisions based largely on the envelop data.

Because the envelope from is a crucial part of the SMTP conversation,
its the easiest place to apply sender based rules, and reject spam.
Conversely its the one thing your ISP may not want you to be able to
'forge'.

The ability of a given user to use the -f flag is a system admins job to
enable or disable.

test to see if you can make php send a message with it set.

If you are suing thunderbird as an MUA, use view source to see what is
the effect

From - Mon Jan 4 10:06:41 2010
X-Account-Key: account6
X-UIDL: UID1263-1238689012
X-Mozilla-Status: 0001
X-Mozilla-Status2: 00000000
X-Mozilla-Keys:

Return-path: <bounce-1...@m.euroffice.com>
Envelope-to: X...@XXX.com
Delivery-date: Mon, 04 Jan 2010 09:57:21 +0000
Received: from m.euroffice.com ([94.236.10.200]:49274)
by mx02.mail.eu.clara.net (mx-vh.clara.net [213.253.3.22]:1025)
with smtp id 1NRjgf-0006V5-8S for X...@XXX.com
(return-path <bounce-1...@m.euroffice.com>); Mon, 04 Jan 2010
09:57:21 +0000
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=lyris; d=m.euroffice.com;
h=from;
b=V3vEkt8FtFxng7PNePIBkEJ9FlUKoBYN7aP+PSRZuhuBbRcjHRl/EFfA+YtO1bERqKpQAm6z
lb7ThIyDXpRlYQ==
From: "Euroffice" <nor...@m.euroffice.com>
To:XXX X...@XXX.COM
Subject: Huge offers and fabulous free gifts to start off 2010!
Date: Mon, 04 Jan 2010 09:35:59 +0000
MIME-Version: 1.0
Content-Type: text/html;
charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
List-Unsubscribe:
<mailto:leave-1746-48.37ec76c15...@m.euroffice.com>
Message-ID: <LYRIS-48369-1746-2010....@m.euroffice.com>
X-Original-Recipient: X...@XXX.com


Look at the first line. That should have a valid sender set. It doesn't.
Its got NO sender at all. Just '-'

So straight into my spam filters it went.

Note also the envelope-to: field. That's who it is to be delivered to.
That comes out of the original invocation of mail or sendmail

in essence
mail envelope-to -f envelop-from message
is the crudest mail you can send.

If you omitt the -f the MTA will patch in what it thinks are sensible
values.

All the header stuff is irrelevant by and large. The MTA wont use it -
its the user agent that scans Bccs and CCS and so on and makes a list of
envelopes to pass to the MTA.


> Dave

Dave

unread,
Jan 7, 2010, 10:56:47 AM1/7/10
to
On Jan 4, 10:30 am, The Natural Philosopher <t...@invalid.invalid>
wrote:
> something like 'web-u...@hostingdomain.com

>
> Its the thing that represents the ultimate BOUNCE address ans is used in
> te SMTP convresation which is spomething like
>
> 500 SMTP SERVER AT BLAT.COM
> HELO
> 500 OK
> MAIL FROM web-u...@bollocks.com

> 666 MAIL REJECTED YOU SPAMMING Cnut
>
> whereas if you do MAIL FROM webmas...@mydomain.com, it may be happier.

>
> The issue there is whether your ISP allows the -f switch to work.
>
> AND the mail relays they talk to allow that as a valid envelope adress.
>
> You should understand that the next part of the mail conversation is a
> series of
>
> RCPT TO smamtar...@somewhere.com

>
> type messages: These may be totally irrespective of the actual headers
> To: and From: or indeed Reply-to:
>
> Indeed the whole POINT of BCC, is that you can set an envelope address
> that gets stripped from the headers.
>
> In short, MTAS respond to the envelope from and to, and what's in the
> headers is really there for humans or MUAs to mess with.
>
> Hence the convention of calling those the NOT envelope address parts.
> They are to an extent preserved inviolate, where the MTAS will make
> routing decisions and bounce decisions based largely on the envelop data.
>
> Because the envelope from is a crucial part of the SMTP conversation,
> its the easiest place to apply sender based rules, and reject spam.
> Conversely its the one thing your ISP may not want you to be able to
> 'forge'.
>
> The ability of a given user to use the -f flag is a system admins job to
> enable or disable.
>
> test to see if you can make php send a message with it set.
>
> If you are suing thunderbird as an MUA, use view source to see what is
> the effect
>
>  From - Mon Jan  4 10:06:41 2010
> X-Account-Key: account6
> X-UIDL: UID1263-1238689012
> X-Mozilla-Status: 0001
> X-Mozilla-Status2: 00000000
> X-Mozilla-Keys:
>
> Return-path: <bounce-1746-48...@m.euroffice.com>

> Envelope-to: X...@XXX.com
> Delivery-date: Mon, 04 Jan 2010 09:57:21 +0000
> Received: from m.euroffice.com ([94.236.10.200]:49274)
>         by mx02.mail.eu.clara.net (mx-vh.clara.net [213.253.3.22]:1025)
>         with smtp id 1NRjgf-0006V5-8S  for X...@XXX.com
>         (return-path <bounce-1746-48...@m.euroffice.com>); Mon, 04 Jan 2010

> 09:57:21 +0000
> DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=lyris; d=m.euroffice.com;
>   h=from;
>   b=V3vEkt8FtFxng7PNePIBkEJ9FlUKoBYN7aP+PSRZuhuBbRcjHRl/EFfA+YtO1bERqKpQAm6z
>           lb7ThIyDXpRlYQ==
> From: "Euroffice" <nore...@m.euroffice.com>

> To:XXX X...@XXX.COM
> Subject: Huge offers and fabulous free gifts to start off 2010!
> Date: Mon, 04 Jan 2010 09:35:59 +0000
> MIME-Version: 1.0
> Content-Type: text/html;
>         charset="ISO-8859-1"
> Content-Transfer-Encoding: quoted-printable
> List-Unsubscribe:
> <mailto:leave-1746-48.37ec76c1599f1e673d008da0748e9...@m.euroffice.com>
> Message-ID: <LYRIS-48369-1746-2010.01.04-09.36.03--eXX...@m.euroffice.com>

> X-Original-Recipient: X...@XXX.com
>
> Look at the first line. That should have a valid sender set. It doesn't.
> Its got NO sender at all. Just '-'
>
> So straight into my spam filters it went.
>
> Note also the envelope-to: field. That's who it is to be delivered to.
> That comes out of the original invocation of mail or sendmail
>
> in essence
> mail envelope-to -f envelop-from  message
> is the crudest mail you can send.
>
> If you omitt the -f the MTA will patch in what it thinks are sensible
> values.
>
> All the header stuff is irrelevant by and large. The MTA wont use it -
> its the user agent that scans Bccs and CCS and so on and makes a list of
> envelopes to pass to the MTA.
>
> > Dave
>
>

Thanks for the response and sorry for the delay. I'm actually not
using an application as an MUA. Instead the email will be submitted
via a web interface and sent to the php mail() function. As a result,
I can't view the source as described above. To be honest, after
looking though what I could find in Google Groups, I wasn't sure if I
needed to add my account info from my hosting company (ie -f
user...@hostingco.com) or the desired email address (ie -f
response_...@mydomain.com) as the value to the -f parameter.

One other note, has anyone in this forum used this functionality with
Gmail (to rule out Google being the culprit in this situation)?

Thanks,
Dave

The Natural Philosopher

unread,
Jan 7, 2010, 11:20:45 AM1/7/10
to
Dave wrote:

>>
>
> Thanks for the response and sorry for the delay. I'm actually not
> using an application as an MUA. Instead the email will be submitted
> via a web interface and sent to the php mail() function.

yes, but you could send it to yourself, and see what headers it produces..


As a result,
> I can't view the source as described above. To be honest, after
> looking though what I could find in Google Groups, I wasn't sure if I
> needed to add my account info from my hosting company (ie -f
> user...@hostingco.com) or the desired email address (ie -f
> response_...@mydomain.com) as the value to the -f parameter.
>


That depends on who yoiur mail realy is.

Ahnd who you want to get bounces.

I would normally use -f 'webm...@mydomain.conm' and have a real
account called that that can receive bounces.


> One other note, has anyone in this forum used this functionality with
> Gmail (to rule out Google being the culprit in this situation)?
>

I dont understand what this has to do with google or gmail. If your
relay accepts it, unless the relay is blacklisted, then anyone will get it.

This is an issue with mainly the first hop between your server and the
mail system it first connects to, unless its so well known that it can
route direct.

> Thanks,
> Dave

Dave

unread,
Jan 7, 2010, 11:31:21 AM1/7/10
to
> usern...@hostingco.com) or the desired email address (ie -f
> response_email_a...@mydomain.com) as the value to the -f parameter.

>
> One other note, has anyone in this forum used this functionality with
> Gmail (to rule out Google being the culprit in this situation)?
>
> Thanks,
> Dave


Perhaps it would help everyone by giving more information on the email
addresses used so that the correct values can be told where to go.
Right now, I am dealing with three email addresses. Which are:

annouc...@mydomain.org
this is an email list that contains
all the desired recipients.
anno...@mydomain.org
this is an actual user account and
not an email list that emails sent
to announ...@mydomains.org will
appear as being from
re...@mydomain.org
this is an email list that should
receive any responses to email sent
from anno...@mydomain.org (eg the
Reply-To address). This was setup
so that replies wouldn't go to
everyone in the annouc...@mydomain.org
list, but to our desired staff members.


my php send() function is as follows:

function send() {
$mime = "";
if ($this->from == 'anno...@mydomain.org') {
# $mime .= "From: reply\@mydomain.org\r\n";
# $mime .= "From: announcer\@mydomain.org\r\n";
$mime .= "Reply-To: reply\@mydomain.org\n";


}
$mime .= "From: ".$this->from. "\n";

if (! empty($this->cc)) { $mime .= "Cc: ".$this->cc. "\n"; }
if (! empty($this->bcc)) { $mime .= "Bcc: ".$this->bcc.
"\n"; }
if (! empty($this->headers)) { $mime .= $this->headers. "\n"; }

# if (! empty($this->body)) { $this->add_attachment($this->body,
"", "text/plain"); }


if (! empty($this->body)) { $this->add_attachment($this->body,
"", "text/html"); }
$mime .= "MIME-Version: 1.0\n".$this->build_multipart();

return( mail($this->to, $this->subject, "", $mime, '-f

anno...@mydomain.org') );
# return( mail($this->to, $this->subject, "", $mime, '-f
re...@mydomain.org') );
# return( mail($this->to, $this->subject, "", $mime, '-f
user...@hostingco.com') );
# return( mail($this->to, $this->subject, "", $mime, '-f
re...@mydomain.org -r re...@mydomain.org') );
}


The commented out lines are prior failed attempts. Hopefully this
will make it easier for all you guru's out there. :)

Dave

Dave

unread,
Jan 7, 2010, 3:32:46 PM1/7/10
to
On Jan 7, 11:20 am, The Natural Philosopher <t...@invalid.invalid>
wrote:

> Dave wrote:
>
> > Thanks for the response and sorry for the delay.  I'm actually not
> > using an application as an MUA.  Instead the email will be submitted
> > via a web interface and sent to the php mail() function.  
>
> yes, but you could send it to yourself, and see what headers it produces..
>
> As a result,
>
> > I can't view the source as described above.  To be honest, after
> > looking though what I could find in Google Groups, I wasn't sure if I
> > needed to add my account info from my hosting company (ie -f
> > usern...@hostingco.com) or the desired email address (ie -f
> > response_email_a...@mydomain.com) as the value to the -f parameter.

>
> That depends on who yoiur mail realy is.
>
> Ahnd who you want to get bounces.
>
> I would normally use -f 'webmas...@mydomain.conm' and have a real

> account called that that can receive bounces.
>
> > One other note, has anyone in this forum used this functionality with
> > Gmail (to rule out Google being the culprit in this situation)?
>
> I dont understand what this has to do with google or gmail. If your
> relay accepts it, unless the relay is blacklisted, then anyone will get it.
>
> This is an issue with mainly the first hop between your server and the
> mail system it first connects to, unless its so well known that it can
> route direct.
>
> > Thanks,
> > Dave
>
>

Would it be possible to have the -f parameter use a mailing list as
its target?

Dave

Dave

unread,
Jan 11, 2010, 6:37:18 PM1/11/10
to

bump for help

Jerry Stuckle

unread,
Jan 11, 2010, 7:17:01 PM1/11/10
to

Did you try it?

Dave

unread,
Jan 12, 2010, 9:03:55 AM1/12/10
to
> jstuck...@attglobal.net
> ==================

Try what?

Jerry Stuckle

unread,
Jan 12, 2010, 9:46:14 AM1/12/10
to

>
> Try what?

"Would it be possible to have the -f parameter use a mailing list as
its target?"

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

jstu...@attglobal.net
==================

Dave

unread,
Jan 12, 2010, 9:49:56 AM1/12/10
to
On Jan 12, 9:46 am, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> Dave wrote:
> > On Jan 11, 7:17 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> >> Dave wrote:
> >>> On Jan 7, 3:32 pm, Dave <hende...@gmail.com> wrote:
> >>>> Would it be possible to have the -f parameter use a mailing list as
> >>>> its target?
> >>>> Dave
> >>> bump for help
> >> Did you try it?
>
> > Try what?
>
> "Would it be possible to have the -f parameter use a mailing list as
> its target?"
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================

I can't get it to work period, so I don't know if its an issue with
the mailing list, or something else I have done. Thats why I included
all the email accounts (with explanations) and php syntax (including
attempts) in previous responses so someone could adjust my syntax to
let me know what it should be (or steer me in the right direction :).

Dave

Jerry Stuckle

unread,
Jan 12, 2010, 10:21:14 AM1/12/10
to
Dave wrote:
> On Jan 12, 9:46 am, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>> Dave wrote:
>>> On Jan 11, 7:17 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>>>> Dave wrote:
>>>>> On Jan 7, 3:32 pm, Dave <hende...@gmail.com> wrote:
>>>>>> Would it be possible to have the -f parameter use a mailing list as
>>>>>> its target?
>>>>>> Dave
>>>>> bump for help
>>>> Did you try it?
>>> Try what?
>> "Would it be possible to have the -f parameter use a mailing list as
>> its target?"
>>
>
> I can't get it to work period, so I don't know if its an issue with
> the mailing list, or something else I have done. Thats why I included
> all the email accounts (with explanations) and php syntax (including
> attempts) in previous responses so someone could adjust my syntax to
> let me know what it should be (or steer me in the right direction :).
>
> Dave

Now I'm confused. First you said the reply to appends the server's
FQDN. Now you say you can't get it to work at all. Which is it?

And why are you escaping the '@' character?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

jstu...@attglobal.net
==================

Dave

unread,
Jan 12, 2010, 10:43:56 AM1/12/10
to
> jstuck...@attglobal.net
> ==================

lol, sorry for that. I will give an overview below.

- When the email is received, it is coming from
"anno...@mydomain.org" (which is correct) and the email list is
working correctly due to no other recipients showing up in the "To" or
"cc" fields.

- When replying, the "re...@mydomain.org@hostingcompany.com" email
address is listed as the "To" field value. This should only read
"re...@mydomain.org".

Hope that helps. Thanks so far!

Dave

The Natural Philosopher

unread,
Jan 12, 2010, 11:27:50 AM1/12/10
to

Then you have a syntax error in the way you set the headers up.

This thread is so old I've forgotten the context.

Anyway no MTA should ever mess with the reply-to: field. There is no need.

If it does, its borked.

Its far more likely that if you are using some noddy php mail library
its buggy, or that you have simply misapplied the headers to it.

if you have somewhere the most basic call to the mail function

mail($to, $subject, $message, $headers, "-f ".$return_path );

Then make sure that $headers is something like :-

"To:fr...@bloggs.com\nReply-To:Alb...@einstein.com\nFrom:m...@mydomain.org\n"

Note that the envelope address(es) is(are) set in the $to part, and the
envelope-from in the $return_path strings respectively.

so $to might be a comma separated list of email addresses. $return_path
might be something like "postm...@mydomain.org" so any bounces come
through to be removed from the mailing list. the headers would need to
be something like:
"To:mailing-lis...@mydonmain.org\nReply-to:mailing-l...@mydomain.org\nFrom:mailin...@mydomain.org".

That call will work reliably on any mail system that is properly
configured, with only one proviso: some mail systems may not let you set
the return path.

I strongly suggest you start sending test mails using that simple
function alone, and examine the headers of what you get, and if
necessary post them here.

There are no constraints in what you put in the Reply-To: header field,
other than if you mess it up, it likely will not work as a reply address.

IF it transpires that the MTA is tacking a domain on it and putting it
in the To: field, then its a broken MTA, and outside the realm of php
advice to fix it.

>
> Dave

Jerry Stuckle

unread,
Jan 12, 2010, 12:48:44 PM1/12/10
to
> lol, sorry for that. I will give an overview below.
>
> - When the email is received, it is coming from
> "anno...@mydomain.org" (which is correct) and the email list is
> working correctly due to no other recipients showing up in the "To" or
> "cc" fields.
>
> - When replying, the "re...@mydomain.org@hostingcompany.com" email
> address is listed as the "To" field value. This should only read
> "re...@mydomain.org".
>
> Hope that helps. Thanks so far!
>
> Dave

OK, now - why are you escaping the '@' signs in your email address?

It looks like your hosting company's email server is adding that to the
reply-to field. It may be caused by the MTA not recognizing the escaped
'@' sign, or they may just be adding it. Is this shared hosting?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

jstu...@attglobal.net
==================

Dave

unread,
Jan 12, 2010, 2:25:52 PM1/12/10
to
On Jan 12, 11:27 am, The Natural Philosopher <t...@invalid.invalid>
> > "announ...@mydomain.org" (which is correct) and the email list is

> > working correctly due to no other recipients showing up in the "To" or
> > "cc" fields.
>
> > - When replying, the "re...@mydomain.org@hostingcompany.com" email
> > address is listed as the "To" field value.  This should only read
> > "re...@mydomain.org".
>
> > Hope that helps.  Thanks so far!
>
> Then you have a syntax error in the way you set the headers up.
>
> This thread is so old I've forgotten the context.
>
> Anyway no MTA should ever mess with the reply-to: field. There is no need.
>
> If it does, its borked.
>
> Its far more likely that if you are using some noddy php mail library
> its buggy, or that you have simply misapplied the headers to it.
>
> if you have somewhere the most basic call to the mail function
>
> mail($to, $subject, $message, $headers, "-f ".$return_path );
>
> Then make sure that $headers is something like :-
>
> "To:f...@bloggs.com\nReply-To:Alb...@einstein.com\nFrom:m...@mydomain.org\n"

>
> Note that the envelope address(es) is(are) set in the $to part, and the
> envelope-from in the $return_path strings respectively.
>
> so $to might be a comma separated list of email addresses. $return_path
> might be something like "postmas...@mydomain.org" so any bounces come

> through to be removed from the mailing list. the headers would need to
> be something like:
> "To:mailing-list-recipie...@mydonmain.org\nReply-to:mailing-list-re...@mydomain.org\nFrom:mailing-l...@mydomain.org".

>
> That call will work reliably on any mail system that is properly
> configured, with only one proviso: some mail systems may not let you set
> the return path.
>
> I strongly suggest you start sending test mails using that simple
> function alone, and examine the headers of what you get, and if
> necessary post them here.
>
> There are no constraints in what you put in the Reply-To: header field,
> other than if you mess it up, it likely will not work as a reply address.
>
> IF it transpires that the MTA is tacking a domain on it and putting it
> in the To: field, then its a broken MTA, and outside the realm of php
> advice to fix it.
>
>
>
> > Dave
>
>

Well, I kept playing with the different commented out sections of code
and finally come across one that works. Looking at it now, I'm not
sure why I didn't realize this sooner. As soon as I changed my Reply-
To and -f to the same email address, it worked just fine (I think I
was a little confused by having to use so many different
addresses :). I apologize for such a simple mistake on my behalf.
Thanks to everyone that did offer time to help resolve this issue
though.

Dave

The Natural Philosopher

unread,
Jan 12, 2010, 3:29:54 PM1/12/10
to

Glad it finally came right.

the key thing to realise with email, is that there are bits of the
address that the relays use, the envelope forms and bits that user
agents use, typically From: To: and Reply-to:

That's five different addresses.

In general Reply:to is where a reply gets sent by a user agent. If its
missing, the From: field will be used, but any machine that needs to
bounce, and/or *validate* a sender address will use the envelope address
set by the -f part of the mail command.


Dave

unread,
Jan 12, 2010, 4:19:01 PM1/12/10
to
On Jan 12, 3:29 pm, The Natural Philosopher <t...@invalid.invalid>


Ahhhh good to know. Thanks for the tip!

0 new messages