Google apps / php contact form ?
On my site there is a php contact form that visitors can use for inquires.
My issue is that when someone sends me a message from the contact form the "From" field of the e-mail shows my default Google apps e-mail address instead of the visitors e-mail address.
Complicating matters is that I would like to host a few different domains on the server all of which would have contact forms on their sites.
Has anyone else run into this issue? I'm in need of some suggestions.
12 Replies
If you're doing this on behalf of customers, having them acknowledge your ability to send mail on their behalf (when you set your Apps account up for it) could be part of your standard setup.
See also
-- David
You'll need to make your PHP code appropriately decide which address to use based on who is completing the form, which is something that will be specific to your application.
– David
If only a few people are going to read those contact-form emails (as is the case of most contact forms), you might as well save the hassle by including the user's e-mail address in the body of the message. Google will probably linkify it, so you can click on it and write your reply. Alternatively, you could set a Reply-To: header. That way, the e-mail will seem to come from a single authorized address, but when you click Reply it'll go to the person who filled out the contact form. Not sure if Google Apps allows custom Reply-To: headers, though.
So random visitor inputs into the contact form:
Name: John Doe
e-mail:
Message: I had a question about blah blah…
The e-mail I receive looks like this:
From: John Doe <
Message: I had a question about blah blah…
All I'm looking to do is just keep
Oh well. I was trying to avoid this, but I suppose I'll have to install some kind of "real" mail server…
@hybinet:
Alternatively, you could set a Reply-To: header. That way, the e-mail will seem to come from a single authorized address, but when you click Reply it'll go to the person who filled out the contact form. Not sure if Google Apps allows custom Reply-To: headers, though.
Google does allow for custom Reply-To: headers and I did try it out. I guess it is just a personal preference, but I just wasn't a fan.
@eekeek:
All I'm looking to do is just keep
JohnDoe@CrazyRandomDomain.com in the From: field when I get the e-mail from the contact form and not have it replaced with my authorized email address. Maybe this can be done with Google apps premier, but as far as I can tell it cannot be done with standard.
Sorry, I misunderstood. I thought you were looking to have a specific per-domain email account (like a standard "info" or whatever) that would send messages on behalf of the form.
It's practical (IMO) to do this for a single address per client/customer/business domain, but clearly not to arbitrarily generate messages with any From address. No, I don't think trying to route through a Google Apps login (any level) is suitable for that.
– David
@eekeek:
Oh well. I was trying to avoid this, but I suppose I'll have to install some kind of "real" mail server…
Use exim and set it to only allow mail from localhost. It's very simple to setup for exactly this scenario.
@glg:
Use exim and set it to only allow mail from localhost. It's very simple to setup for exactly this scenario.
Awesome. I'll give it a look over in the library. Can exim be setup to deal with multiple domains?
Would this cause any issues with msmpt?
From: "customer@hotmail.com" <noreply@yourdomain.com>
Reply-To: customer@hotmail.com</noreply@yourdomain.com>
This way shows better what is actually going on but will make for a confusing inbox:
From: "Company Contact Form" <noreply@yourdomain.com>
Reply-To: customer@hotmail.com</noreply@yourdomain.com>
Will this work with Google Apps (assuming the noreply account is setup at GA)? The first example probably smells like spam, so you might need to create a filter at GA to prevent it from being flagged as such.
EDIT: I guess a mixture of them both and something like the following would be best?
From: "Customer Enquiry: customer@hotmail.com" <noreply@yourdomain.com>
Reply-To: customer@hotmail.com</noreply@yourdomain.com>
EDIT2:
Just tested and all the above methods work fine. I can't say how they compare when it comes to spam detection since I have everything set from the address I used to not be marked as spam.
@KyleMac:
This way shows better what is actually going on but will make for a confusing inbox:
From: "Company Contact Form" <noreply@yourdomain.com> Reply-To: customer@hotmail.com</noreply@yourdomain.com>
Like you said it does make for a confusing inbox. That’s why I wasn’t a big fan of that solution. I haven’t had much time to work on the problem or figure out exim. I’m still not sure if running exim and msmpt at the same time will cause any problems. Also, everything I have looked at for exim dealing with multiple virtual hosts has caused my head to spin so I’m still trying to find a good tutorial on that. Let me know if you come up with anything!