質問

I have developed a website hosted on 1and1 which has a webform for submitting contact information.

The client wants to retain his current GMAIL address for receiving the emails.

Can I use his email address in the php mailer settings? My understanding is that 1and1 will reject the website generated emails unless the from address is the same as his domain name. I am new to this...

役に立ちましたか?

解決

You can add a FROM: someone@example.com header in the PHP mail() function, which will show up on the recipient mail client as being from someone at someone@example.com. Some mail servers may tag it as spam if they identify the email as not coming from a mail server which is authorised to send emails for that domain.

Additionally, 1and1 may drop emails from being sent from domains other than those hosted by them/authorised by them. It is probably worth contacting them to clarify this.

Something like the following should do what you want, provided there are no blocks etc. But as Constantine says above, it may go into a spam folder etc.

mail("recipient@domain.com", "Subject here...", "Message Here", "From: someone@example.com");

You could always look into setting a Reply-To: header (similar to the From: above if you need to send it from a domain hosted by 1and1.

他のヒント

I can't see why it wouldn't work. Try sending an email to a test gmail account and see if it works. I have a feeling it will end up on the spam folder though.

mail('YourTestEmail@gmail.com', 'Test Subject', 'Test message');
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top