1,105,578 Community Members

Forwarding a web page to a friend's e-mail

Member Avatar
Dilnesaw
Newbie Poster
9 posts since Jan 2008
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
-1
 

Can somebody just drop me a code that I can use to forward a web page to some body's e-mail ? I am still a beginner for PHP. If you are not able to give the codes, I appreciate if I can get the general direction.

Thank you very much.

Dilnesaw

Member Avatar
Walkere
Junior Poster in Training
57 posts since Jan 2008
Reputation Points: 19 [?]
Q&As Helped to Solve: 5 [?]
Skill Endorsements: 0 [?]
 
0
 

I assume you mean e-mail the link to the person. If you want to e-mail the actual page, that's a little different...

The most basic way to do e-mail a message would be to use the mail() function.

mail() takes a few parameters

  • $to - the recipient's e-mail address
  • $subject - the subject line (no newline characters!)
  • $message - the body of the message
  • $headers - a list of headers, including "From: myemail@domain.com"

So, you can gather the appropriate information with a form. For example, you might include an "e-mail this" link on a page. The user enters a "To:" and "From:" address, and the message and subject are created by the script.

Here's an example of it in action, with some hard-coded variables...

$to = "your-email@domain.com";
$subject = "Hey!  Check out this cool site.";
$message = "I found this site at http://mysite.com.  Check it out!";
$headers = "From: my-email@domain.com";

mail($to, $subject, $message, $headers);

That's all there is to it. Now just have your script populate those variables with the form information and you're good to go.

For some more examples, go read about mail() on php.net.

fatihpiristine
Deleted Member
 
0
 

u know it is not gonna work if your server is not configured to send email without authorization.

better u login and fast!

Member Avatar
Walkere
Junior Poster in Training
57 posts since Jan 2008
Reputation Points: 19 [?]
Q&As Helped to Solve: 5 [?]
Skill Endorsements: 0 [?]
 
0
 

u know it is not gonna work if your server is not configured to send email without authorization.

better u login and fast!

That is true. The simple mail() function won't work if you need authentication in order to send e-mails.

However, most SMTP servers don't require any type of authentication. If anything, they just check to see that the origin of the message is from inside the network.

I've been able to use the mail() function perfectly fine on a free host (Frihost.com) and a paid host (ixwebhosting.com). Neither required SMTP authentication.

- Walkere

Member Avatar
Dilnesaw
Newbie Poster
9 posts since Jan 2008
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I assume you mean e-mail the link to the person. If you want to e-mail the actual page, that's a little different...

The most basic way to do e-mail a message would be to use the mail() function.

mail() takes a few parameters

  • $to - the recipient's e-mail address
  • $subject - the subject line (no newline characters!)
  • $message - the body of the message
  • $headers - a list of headers, including "From: myemail@domain.com"

So, you can gather the appropriate information with a form. For example, you might include an "e-mail this" link on a page. The user enters a "To:" and "From:" address, and the message and subject are created by the script.

Here's an example of it in action, with some hard-coded variables...

$to = "your-email@domain.com";
$subject = "Hey!  Check out this cool site.";
$message = "I found this site at http://mysite.com.  Check it out!";
$headers = "From: my-email@domain.com";

mail($to, $subject, $message, $headers);

That's all there is to it. Now just have your script populate those variables with the form information and you're good to go.

For some more examples, go read about mail() on php.net.

Thank you so much. I will try this. Hopefully it will work.

Dilnesaw

Member Avatar
byanothername
Newbie Poster
3 posts since Jan 2008
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

where is the information in this script which refers to the actual url of the page you wish to send on to a friend?


best wishes
Mike

Member Avatar
nav33n
Purple hazed!
3,894 posts since Nov 2007
Reputation Points: 472 [?]
Q&As Helped to Solve: 381 [?]
Skill Endorsements: 20 [?]
Team Colleague
Featured
 
0
 

$message = "I found this site at http://mysite.com. Check it out!";

There.

Member Avatar
byanothername
Newbie Poster
3 posts since Jan 2008
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thank you. I shall continue to do my good work for the Universe.

best wishes
Mike

Member Avatar
nav33n
Purple hazed!
3,894 posts since Nov 2007
Reputation Points: 472 [?]
Q&As Helped to Solve: 381 [?]
Skill Endorsements: 20 [?]
Team Colleague
Featured
 
0
 

Wow! great.. :P

Member Avatar
byanothername
Newbie Poster
3 posts since Jan 2008
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

seriously though, thanks for the tip.
I was hoping to use a php script so that people could make up their own quotes on this page http://www.sixtysixninetynine.com/, then submit them to the site and/or email the link to a friend. I think php could be used to display the page with the new quotes in it - ie so they could view a live page, before sending it on to someone else. Th epart they would replace with thie rown quotes would be "I see that French trader lost the bank nearly 5 billion Euros."
"Do you mean they won't make a profit?"
any thoughts on that?

best wishes
Mike

Member Avatar
nav33n
Purple hazed!
3,894 posts since Nov 2007
Reputation Points: 472 [?]
Q&As Helped to Solve: 381 [?]
Skill Endorsements: 20 [?]
Team Colleague
Featured
 
0
 

Yep. Possible.

Member Avatar
danielwalters6
Newbie Poster
4 posts since Mar 2007
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I assume you mean e-mail the link to the person. If you want to e-mail the actual page, that's a little different...

The most basic way to do e-mail a message would be to use the mail() function.

mail() takes a few parameters

  • $to - the recipient's e-mail address
  • $subject - the subject line (no newline characters!)
  • $message - the body of the message
  • $headers - a list of headers, including "From: myemail@domain.com"

So, you can gather the appropriate information with a form. For example, you might include an "e-mail this" link on a page. The user enters a "To:" and "From:" address, and the message and subject are created by the script.

Here's an example of it in action, with some hard-coded variables...

$to = "your-email@domain.com";
$subject = "Hey!  Check out this cool site.";
$message = "I found this site at http://mysite.com.  Check it out!";
$headers = "From: my-email@domain.com";

mail($to, $subject, $message, $headers);

That's all there is to it. Now just have your script populate those variables with the form information and you're good to go.

For some more examples, go read about mail() on php.net.

Brilliant code - easy to use an understand, have tweaked for my own purpose!

Member Avatar
Dilnesaw
Newbie Poster
9 posts since Jan 2008
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thank you Walkere for the iformation you posted. I am going to test if it works. I appreciate.
Dilnesaw

Member Avatar
elmerthomas
Newbie Poster
1 post since Jul 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

The limits of my website building
skills - using templates and simple
programs like yahoo sitebuilder.

All I want to do is put a business card
size box on my page so that peole can
forward my page to each other.

Help!

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article