Link Delivery to email address

the mail() function

Moderators: macek, egami, gesf

Post Reply
User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Post by Alexej Kubarev » Tue Aug 02, 2005 10:59 am

well.. there isnt much of a script but a function calles mail() if you take a look at php.net manual and look at the mail() function : you will be able to understand how it works. take a look at comments as well

php-vikas
New php-forum User
New php-forum User
Posts: 164
Joined: Mon Apr 14, 2003 12:25 am
Location: India
Contact:

Post by php-vikas » Tue Aug 02, 2005 8:52 pm

You can use the following function for validating the email address.

Code: Select all


function error_invalid_email($email){
  if(!eregi('^([._a-z0-9-]+[._a-z0-9-]*)@(([a-z0-9-]+\.)*([a-z0-9-]+)(\.[a-z]{2,3})?)$',$email)){

      print "<table width=\"450\" border=\"0\" cellspacing=1 cellpadding=1 ><tr><td>";

      print "<h2><font color=red>Error!</h2></font>";
      print "<font face=Verdana size=2>You have entered an invalid email address. <BR><BR><a href=\"javascript:history.go(-1)\">Click here to correct it.</a></font><BR>";
              print "</td></tr></table>";
   }
}


User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Post by Alexej Kubarev » Wed Aug 03, 2005 1:59 am

php-vikas : you need to read a bit better: he wants to validate the email address so that its an email address that is working and stuff...
for validating if an email address MAY be a valid one in format: use Javascript
What you need to do is create a message body containing some text and that link and put it into, say $message variable

Code: Select all

<?php
$to = "user@domain.com";
$subject = "Download link";
$message = "Hi! Here is your download link: http://www.download.com/something.rar";
$headers = "From: Download support<no-reply@me.org>\n\r";
mail($to, $subject, $message, $headers);
?>

php-vikas
New php-forum User
New php-forum User
Posts: 164
Joined: Mon Apr 14, 2003 12:25 am
Location: India
Contact:

Post by php-vikas » Thu Aug 04, 2005 12:11 am

You are right Mr. Alexei Kubarev.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest