Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Mail

Link Delivery to email address

the mail() function

Moderators: macek, egami, gesf

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
diyum
New php-forum User
New php-forum User
 
Posts: 3
Joined: Tue Aug 02, 2005 10:39 am

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
User avatar
Alexej Kubarev
Site Admin
Site Admin
 
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län

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
diyum
New php-forum User
New php-forum User
 
Posts: 3
Joined: Tue Aug 02, 2005 10:39 am

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>";
   }
}

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

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);
?>
User avatar
Alexej Kubarev
Site Admin
Site Admin
 
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län

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

You are right Mr. Alexei Kubarev.
php-vikas
New php-forum User
New php-forum User
 
Posts: 164
Joined: Mon Apr 14, 2003 12:25 am
Location: India

Thanks a lot

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

Hi,

Thanks a lot for the code

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


Return to PHP coding => Mail

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.