![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| Pear Pear programming, this is a very complex subject as with using pear with php can be a difficult task for some, so lets talk pear. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| I am using PEAR's Mail::Factory to send an email from a feedback form on my website. I am getting it to send an email via my mail server, using smtp authentication. I would like to send an email with the following headers: From: To: Subject: Sender: I would like the From address to be user defined, via a form they fill out, however, when the email is actually sent, I would like it to use a different address for the MAIL FROM command. So for example: A user fills out a web form from the address: webuser@hotmail.tld I would like the headers to be: From: webuser@hotmail.tld To: destination@gmail.tld Subject: Website Feedback Sender: phpuser@mydomain.tld I would like the email to be sent with the command: MAIL FROM:<phpuser@mydomain.tld> On this info page: http://pear.php.net/manual/en/packag....mail.send.php in the example it says to use: $mail_object->send($recipients, $headers, $body); So when you send the email, there doesn't seem to be a way to specify the MAIL FROM command, it must take it directly out of the headers you give it - ie from the From: Header. Is there a way in which I can specify a MAIL FROM address which is different from the From address in the headers? Thanks for your help, Ben | |||
| Advertisements |
| | #2 | ||
| On 4/26/07, Ben Wylie <pear@benwylie.co.uk> wrote: > I am using PEAR's Mail::Factory to send an email from a feedback form on > my website. > > I am getting it to send an email via my mail server, using smtp > authentication. > I would like to send an email with the following headers: > > From: > To: > Subject: > Sender: > > I would like the From address to be user defined, via a form they fill > out, however, when the email is actually sent, I would like it to use a > different address for the MAIL FROM command. > > So for example: > > A user fills out a web form from the address: > > webuser@hotmail.tld > > I would like the headers to be: > > From: webuser@hotmail.tld > To: destination@gmail.tld > Subject: Website Feedback > Sender: phpuser@mydomain.tld > > I would like the email to be sent with the command: > MAIL FROM:<phpuser@mydomain.tld> > > On this info page: > http://pear.php.net/manual/en/packag....mail.send.php > in the example it says to use: > > $mail_object->send($recipients, $headers, $body); > > So when you send the email, there doesn't seem to be a way to specify > the MAIL FROM command, it must take it directly out of the headers you > give it - ie from the From: Header. > > Is there a way in which I can specify a MAIL FROM address which is > different from the From address in the headers? > Hmmm...if there isn't a way to do it yet I'd say that perhaps it should be using the values in the authentication options if they're specified. Then again, perhaps it is done this way because a mail server won't allow you to do such a thing. A work-around may be to set the Reply-To header to what you want the "from" address to be. -- Justin Patrin | |||
| | #3 | ||
| Justin Patrin wrote: > On 4/26/07, Ben Wylie <pear@benwylie.co.uk> wrote: >> I am using PEAR's Mail::Factory to send an email from a feedback form on >> my website. >> >> I am getting it to send an email via my mail server, using smtp >> authentication. >> <snip> >> >> Is there a way in which I can specify a MAIL FROM address which is >> different from the From address in the headers? >> > > Hmmm...if there isn't a way to do it yet I'd say that perhaps it > should be using the values in the authentication options if they're > specified. Then again, perhaps it is done this way because a mail > server won't allow you to do such a thing. > > A work-around may be to set the Reply-To header to what you want the > "from" address to be. You're right about the work-around, I was wondering if it would be possible to do it the other way so it isn't so obvious. In fact a mailserver will allow you to do these things. Once you have authenticated yourself with a mail server, it will let you send an email to and from any address, so this shouldn't determine any of your headers or your MAIL FROM address. Google does it this way for gmail, so you can specify a different From: email address but it will put in the Sender: header specifying your gmail account and will use your gmail account in the MAIL FROM command. This way spam filtering mechanisms like SPF are still met, as the MAIL FROM address can be an address that is allowed to send an email from that server. If you are just sending emails out from any old address via my server, if the domains for these addresses specify their SMTP servers in SPF, the recipient may reject the email due to my ip address not matching the servers in their SPF record. It would be nice if you could do it like this: $mail_object->send($recipients, $mailfrom, $headers, $body); If the $mailfrom is not there, it uses the From header, but if it is there, it uses that address in the MAIL FROM command. Thanks Ben | |||
| | #4 | ||
| Justin Patrin wrote: > On 4/26/07, Ben Wylie <pear@benwylie.co.uk> wrote: >> I am using PEAR's Mail::Factory to send an email from a feedback form on >> my website. >> >> I am getting it to send an email via my mail server, using smtp >> authentication. >> <snip> >> >> Is there a way in which I can specify a MAIL FROM address which is >> different from the From address in the headers? >> > > Hmmm...if there isn't a way to do it yet I'd say that perhaps it > should be using the values in the authentication options if they're > specified. Then again, perhaps it is done this way because a mail > server won't allow you to do such a thing. > > A work-around may be to set the Reply-To header to what you want the > "from" address to be. You're right about the work-around, I was wondering if it would be possible to do it the other way so it isn't so obvious. In fact a mailserver will allow you to do these things. Once you have authenticated yourself with a mail server, it will let you send an email to and from any address, so this shouldn't determine any of your headers or your MAIL FROM address. Google does it this way for gmail, so you can specify a different From: email address but it will put in the Sender: header specifying your gmail account and will use your gmail account in the MAIL FROM command. This way spam filtering mechanisms like SPF are still met, as the MAIL FROM address can be an address that is allowed to send an email from that server. If you are just sending emails out from any old address via my server, if the domains for these addresses specify their SMTP servers in SPF, the recipient may reject the email due to my ip address not matching the servers in their SPF record. It would be nice if you could do it like this: $mail_object->send($recipients, $mailfrom, $headers, $body); If the $mailfrom is not there, it uses the From header, but if it is there, it uses that address in the MAIL FROM command. Thanks Ben | |||
| Featured Websites | ||||
|
![]() |
| Tags: address, different, factory, header, mail, specify |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Script to do a form submition to e-mail. | mythikal | Website Coding | 7 | 10-26-2008 7:10 AM |
| GOOD e-mail account ? | modric | Web Site Hosting | 22 | 05-19-2007 12:36 PM |
| Need help in E-Mail marketing | marriane | Website Reviews And Website Questions | 2 | 07-17-2006 4:28 AM |
| Basic Usage Of Php Mail Function | Whatcha | PHP | 3 | 05-11-2006 2:46 AM |
| Featured Websites | ||||
|