Jump to content

email form


vijdev

Recommended Posts

hi...someone pleeeeeeeease help me on php mail problem on WAMP.

 

code:

<?php

mail("mymail@gmail.com","Hello World","Hi,this is my first php  *****ofcourse i have used a proper mail id!*******

 

mail!!");

?>

 

where do i set up the smtp port?...or what do i need to do..

 

i have modified php.ini as follows:

 

[mail function]

; For Win32 only.

SMTP = smtp.gmail.com

 

; For Win32 only.

sendmail_from = mymail@gmail.com  *****ofcourse i have used a proper mail id!*******

 

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").

;sendmail_path =

 

i get this error:

 

Warning: mail() [function.mail]: SMTP server response: 530 5.7.0 Must issue a STARTTLS command first m24sm2469571waf in C:\wamp\www\play\firstmail.php on line 2

 

if am missing too much on basics....please help me from scratch..i am new and i ahve spent more than 10 days struggling now...!

pleeeeeeeeeease!

thanks,

vk

Link to comment
Share on other sites

$email = $_POST['email'];

if (check_email_address($email)) {

} else {
die('You have given an invalid email. ');
}

// End of Valid Email


// here we encrypt the password and add slashes if needed
$_POST['pass'] = md5($_POST['pass']);
if (!get_magic_quotes_gpc()) {
$_POST['pass'] = addslashes($_POST['pass']);
$_POST['username'] = addslashes($_POST['username']);
}

// now we insert it into the database
$insert = "INSERT INTO users (username, password, email)
VALUES ('".$_POST['username']."', '".$_POST['pass']."', '".$_POST['email']."')";
$add_member = mysql_query($insert);

// Send Email to confirm registration

$mail_to=$_POST['email'];
$mail_sub="Confirmed Registration";

// You must set a sender through message header
$MsgHeader="From: Northern Knight";

// These two lines are required
$MsgHeader .= "MIME-Version: 1.0\n";
$MsgHeader .= "Content-type: text/html; charset=us-ascii\n";

// Message body is HTML
$MsgBody = "
<html>
<head>
	<title>Wwpknights Confirmed Registration</title>
</head>
<body>
	<h1>Confirmed Registration</h1>
	<p>Thank you for registering with wwpknights.com. You are now welcome to login and enjoy the benefits as a user. If you need help at any time please write to contact@thefilmgod.com or fill out a contact form on the 	website.</p>
	<p> Sincerely,<br>
	<strong>NorthernKnight</strong>
	</p>
</body>
</html>";

// Actual sending operation
mail($mail_to, $mail_sub, $MsgBody, $MsgHeader);
?>

 

Worked on my website. Its done with properly. Make sure smtp_port is set to 25 that is the default. Otherwise it might be messed up!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.