The question in the title is one of the three i have. So let's give more details about them.
1st How to send email to oneself ?
I have a contact form in my website, from which users can send emails to me. I'm using the mail function of PHP to do so. I was wondering how to send email to my own email address, which will more likely be for example : myname@mydomainname.com Is this even a good idea ? Or maybe storing incoming emails in a sql table contact is better ?
2nd How to answer emails received ?
Now that i received emails according to question 1, how do i respond ? i mean from which email address (or account) ? and i don't know if i am right, but it seems that my main email address has to stay unknown for users to avoid spamming or direct contacting instead of using contact form. So the hidden part of the question is how to keep my email address hidden when sending emails. I know in php i can add the : Reply-To: myname <noreply@mydomainname.com>
to the header.
But in this particular case, i'll be responding from the real account and not php.
3rd how to hide my email when sending links to reset password / welcome mails (php) ?
I feel this question should've came before 2nd one. And you may notice that i answered myself with the noreply header tip. however i'm not sure of my own answer since i haven't tried it yet. My actual code should look like this :
$headers = array();
$headers[] = "MIME-Version: 1.0";
$headers[] = "Content-type: text/plain; charset=iso-8859-1";
$headers[] = "To: ".$username." <".$email.">";
$headers[] = "From: domainname <somename@domainname.com>";
$headers[] = "Reply-To: domainname <noreply@domainname.com>";
$headers[] = "X-Mailer: PHP/".phpversion();
mail($to, $subject, $message, implode("\r\n", $headers));
Is it sufficient to keep my email address hidden from the recipient ?
thank's in advance.