If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > how to send email using php

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-14-11, 03:24
Vinay007 Vinay007 is offline
Registered User
 
Join Date: May 2011
Posts: 11
how to send email using php

i want 2 verify whether the email entered by d user is correct or not..
plz help me how to send email with verification code using php..??
Reply With Quote
  #2 (permalink)  
Old 05-15-11, 17:05
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
Thread moved to PHP forum.
__________________
Mike
Reply With Quote
  #3 (permalink)  
Old 05-16-11, 19:32
kitaman kitaman is offline
Papabi's friend
 
Join Date: Sep 2009
Location: Ontario
Posts: 629
Am I correct in assuming that you want to do the following:
Have someone enter a new user_id and password, and email address.
Then send an email to that address with a link in it, so that when the recipient clicks on the link his account will be activated.
If so:
On the original form where the email address is entered, save the data along with the session id to a database.
In the email create a link with the session_id as:
....abc.com/confirm.php?id=$SESSION_ID
Have the confirm.php session use the data from the link to look up the session id and confirm the user_id and password.
Reply With Quote
  #4 (permalink)  
Old 05-18-11, 22:34
rguy84 rguy84 is offline
Registered User
 
Join Date: Jun 2004
Location: Seattle, WA
Posts: 601
Quote:
Originally Posted by Vinay007 View Post
i want 2 verify whether the email entered by d user is correct or not..
plz help me how to send email with verification code using php..??
You will need to hash out what you are asking Vinay. I cannot tell if you want to make sure the e-mail is not like user217@kewy88w7****.com OR are you asking how to make it so on form submit a random code is sent to the address supplied to verify the account.
__________________
Ryan
My Blog
Reply With Quote
  #5 (permalink)  
Old 05-19-11, 04:16
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,262
verifying email addresses is tricky
the first part is easy enough, to validate it looks like a valid email address. there's plenty of such validation schemes using regular expressions... do a google on "php email validation"

verifying that the address is valid usually requires sending an email to that address and request the user authenticates themselves. usually you would include a URL to a script on your site with a unique reference embedded in the URL.

you can assume the email address isn't verified if it gets bounced back to you, but that could take days in some cases. same email servers are a bit more active and you could find out in a matter of minutes. however the only certain way to verify ius to send an email with authentication URL

the URL could be

http://URL.to.my.site/authentication...87436cbd9o1019

where
authenticationscript.php is the name of the authentication script
the hashcode is the name of the variable you want to process in the script
oi7y87436cbd9o1019 is the value for that variable.

I'd suggest the hashcode is some form of encrypted message which uniquely identifies who the user is using somehting like the mcrypt class.

your encryption message should include padding characters so that a malicious user would struggle to break your key if they tried to register the site.
I'd suggest a not only the bit that uniquely identifies the user but also something else. that something else could be some free form text
$key = "insert your key here";
$text = "Authenicate user:".$userid;

$encrypted_data = mcrypt_ecb (MCRYPT_3DES, $key, $text, MCRYPT_ENCRYPT);

other padding text could include dates+times,even some gibberish (makeup some letters to pad before and after the userid.)
use a comma, or other punctuation symbols that you know will not be in the userid in the string to delimit the sections you want to extract
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #6 (permalink)  
Old 05-19-11, 13:58
Vinay007 Vinay007 is offline
Registered User
 
Join Date: May 2011
Posts: 11
code not working.. plz help

<?php

ini_set("SMTP","smtp.gmail.com");
$from = "abcd@gmail.com";
$to = "abcd@gmail.com"; //here i have entered this id but its not working wen i wrote my email id and host and port n everything..
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";

$host = "abcd.org";
$port = "222";
$username = "abcd";
$password = "def";
$header = "From: ".$from;

mail($to,$subject,$body,$header);

die();
?>

Warning: mail() [function.mail]: SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. v6sm1818532pbc.27 in C:\xampp\htdocs\xampp\mail1.php on line 15
Reply With Quote
  #7 (permalink)  
Old 05-19-11, 14:23
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
The format of the header looks very wrong to me - have you looked at the manual? shouldn't it require various control codes at the end for end of lines etc? Also you shouldn't be storing text passwords in the database - they should be encrypted (see md5 etc).
__________________
Mike
Reply With Quote
  #8 (permalink)  
Old 05-24-11, 10:03
kitaman kitaman is offline
Papabi's friend
 
Join Date: Sep 2009
Location: Ontario
Posts: 629
Quote:
Warning: mail() [function.mail]: SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. v6sm1818532pbc.27 in C:\xampp\htdocs\xampp\mail1.php on line 15
There is the possibility that the mail server requires you to retrieve email prior to sending, for the purpose of authentication.
Reply With Quote
  #9 (permalink)  
Old 06-22-11, 06:03
Kailee Kailee is offline
Registered User
 
Join Date: Jun 2011
Posts: 15
I have no more idea but it will help you.
How to Send Email from a PHP Script - About Email
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On