Link Delivery to email address

the mail() function

Moderators: macek, egami, gesf

diyum
New php-forum User
New php-forum User
Posts: 3
Joined: Tue Aug 02, 2005 10:39 am

Link Delivery to email address

Postby diyum » Tue Aug 02, 2005 10:42 am

Hey Friends,
I am stuck here, and I need some help.

I have a website and I am giving dowloads, but i need to take their email address and then send link to their email address, so that visitor doesn't give me a fake address.

Can anyone give me script for this.

thanx in advance

Dharran

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:

Postby 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

diyum
New php-forum User
New php-forum User
Posts: 3
Joined: Tue Aug 02, 2005 10:39 am

newbie

Postby diyum » Tue Aug 02, 2005 11:11 am

Hi Alexei Kubarev,


I am newbie and novice can i get the script, so that i can use that.

rgds
diyum

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

Postby 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:

Postby 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:

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

You are right Mr. Alexei Kubarev.

diyum
New php-forum User
New php-forum User
Posts: 3
Joined: Tue Aug 02, 2005 10:39 am

Thanks a lot

Postby diyum » Thu Aug 04, 2005 2:31 am

Hi,

Thanks a lot for the code

Dharran


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 1 guest

cron