Jump to content
microlarva

$from contact form problem

Recommended Posts

Hello.

Well I'm quite new to PHP (maybe you'll see it in my Q), but I do know some bits and pieces.
Well I've come to 2 or 3 probs on my way to creating my contact form.
 

I have a form on my website and it's working great, but my mails are sent to my gmail acc and I would

love to know if there's a way to specify the sender in my $from line? Cause now my first lines of PHP looks like this:

<?php

// email address that will be showned as a sender
$from = 'New mail from the website <newmail@mywebsitename.eu>';

// email address where the mail should be send to
$sendTo = 'mywebsitesname.eu <mypersonalmail@gmail.com>';

// subject of the email
$subject = 'New message from my mywebsitename.eu site';

And the thing that I would like to do is to change $from line to something like:
$from = $_POST['email'];
So that when I would get the mail to my gmail acc it would be showned as it is from the sender and I would be able to reply to him from one click and not to copy paste his email from my form to new message and then prob copy paste the content of his msg to my reply msg etc... 
Now I know this is a bit ''so-so'' cause I would be faking or spoofing the senders mail, but I'm sure there's a solution. Or at least if that's not possible, to create some sort of code that would prepare my reply_to mail with one click.

Hope I didn't wrote to much of stuff with to many words, but I'm a bit of a chatty fella :D.

 

Edited by microlarva

Share this post


Link to post
Share on other sites

It's probably better to use reply-to only, some services will block email if the from address isn't associated with your server.  For example, gmail might block a mail if your server claims that the email is from some other gmail user when gmail knows that your server is not gmail.

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×