Results 1 to 9 of 9
  1. #1
    Join Date
    May 2011
    Posts
    11

    Unanswered: 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..??

  2. #2
    Join Date
    Jun 2007
    Location
    London
    Posts
    2,527
    Thread moved to PHP forum.

  3. #3
    Join Date
    Sep 2009
    Location
    Ontario
    Posts
    1,057
    Provided Answers: 1
    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.

  4. #4
    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

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    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 on the Tiger 800 or the Norton

  6. #6
    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

  7. #7
    Join Date
    Jun 2007
    Location
    London
    Posts
    2,527
    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).

  8. #8
    Join Date
    Sep 2009
    Location
    Ontario
    Posts
    1,057
    Provided Answers: 1
    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.

  9. #9
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •