How to get user mails in my free gmail inbox through contact us form on my website. I do not use email with my website name . i use free gmail. I tried many script but the all need email account on domain.
views:
969answers:
4Basically, it involves the PHP mail()
function:
<?php
mail(yourGmailAddress, object, message);
?>
As you have already observed, this solution works only if the webserver operates a mail server. This mail server may forbid unknown users. So you need to have an email account on that web/mail server (I believe this is the case). The second step then is to forward mail from your website address to you gmail account. I am 90% certain that it is possible from your gmail configuration. It may also be possible from your website mail configuration. But don't configure both!
You can also put your email address into "action" attribute of the form element. But that's very unreliable. Like this:
<form method='post' action='mailto:[email protected]?Subject=Hello'>
...
</form>
Users must have email client installed and configured for this to work properly. There are some other drawbacks. You have to do some research to find whether this method is for you or not. http://www.google.com/search?client=opera&rls=en&q=form+action+mailto&sourceid=opera&ie=utf-8&oe=utf-8
Does this question have something to do with This One?
Well, so you have a form on your site, your users fill it up and you need an email with that data, right?
Simple example:
<form action="sendMail.php" method="post">
Name: <input type="text" name="name" id="name" /><br />
Email: <input type="text" name="email" id="email" /><br />
Text: <textarea name="text"></textarea><br />
<input type="submit" value="Send" />
</form>
then, the php page wich send the mail:
//php sendThis.php page
<?php
require("class.phpmailer.php");
$name = $_POST['name'];
$email = $_POST['email'];
$text = $name . ', ' . $email . ' has filled the form with the text:<br />' . $_POST['text'];
$from = '[email protected]';
$to = '[email protected]';
$gmailPass = 'your gmail password';
$mail = new PHPMailer();
$mail->IsSMTP();
// enable SMTP authentication
$mail->SMTPAuth = true;
// sets the prefix to the server
$mail->SMTPSecure = "ssl";
// sets GMAIL as the SMTP server
$mail->Host = 'smtp.gmail.com';
// set the SMTP port
$mail->Port = '465';
// GMAIL username
$mail->Username = $from;
// GMAIL password
$mail->Password = $gmailPass;
$mail->From = $from;
$mail->FromName = $from;
$mail->AddReplyTo($from, $from);
$mail->Subject = 'This is a test!';
$mail->Body = $text;
$mail->MsgHTML($text);
$mail->IsHTML(true);
$mail->AddAddress($to, $to);
if(!$mail->Send()){
echo $mail->ErrorInfo;
}else{
echo 'sent!';
$mail->ClearAddresses();
$mail->ClearAttachments();
}
?>
EDIT: just tested and works fine. Make sure that the 3 files (class.phpmailer.php, class.pop3.php and class.smtp.php) are in the correct include path
try enabling openssl
uncomment the line: extension=php_openssl.dll
in php.ini