-3

I tried and follow a tutorial and I made a mail form. I wonder how the mail will look like, who is the sender? I never can try to send one because I'm on localhost..

can I use my gmail as sender? means can I create a form that use gmail acc to send email without need to go to gmail?

3 Answers3

0

You can use the PHP IMAP functionality or phpmailer with SMTP functionality to basically send from any Mail-Account:

http://php.net/manual/de/book.imap.php

https://github.com/Synchro/PHPMailer

bardiir
  • 14,556
  • 9
  • 41
  • 66
0

you can send mail using PHP as plain text, or you can send a HTML email, allowing you to format the text, borders, background etc.

You really need to use a live server in order to use the mail() function, and you don't have to have a gmail account to send it. If you want it to appear to have come from you, simply use your email address in the "from" paramenter.

Lee H
  • 1
  • 1
0

basically you can use any email address you like, even non-existing addresses, because this is just what is shown to the recipient, the background email address is always an address from the server (hoster) you send the email from.

$text = "<html><head><title>your title</title></head>
         <body>

   <!-- html here -->

         </body>
         </html>";
$recipient = "$email"; //Mailadresse
$sender = "anything@youlike.com"; 
$subject = "Anything you like";
$answer = "anything@youlike.com"; 
$hea  = "MIME-Version: 1.0\r\n";
$hea .= "Content-type: text/html; charset=iso-8859-1\r\n";
$hea .= "From: $sender\r\n";
$hea .= "Reply-To: $answer\r\n";
mail($recipient,$subject,$text,$hea);
qsi
  • 683
  • 1
  • 7
  • 16