Solved

Trying To Send Email from variable

Posted on 2014-03-03
9
294 Views
Last Modified: 2014-03-04
I have a form that I want to send an email to the email address that is put in the email field.  However what I did is not working.

http://www.bricooper.com

Click on "Share"

This is what I put.
// User settings
$to = "$email";
$subject = "Bri Cooper";

Open in new window

contact.php
0
Comment
Question by:DS928
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
9 Comments
 
LVL 36

Assisted Solution

by:Loganathan Natarajan
Loganathan Natarajan earned 350 total points
ID: 39902483
Did you get any error message on the screen? You can try like this in the variable,
$to = $email;

Open in new window

0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 39902487
I tested your form and it is being submitted and it says, "Your message was successfully sent. " .. .just your inbox/spam folders whether you've got any email.
0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 39902493
I just checked my inbox, it has come... so please change the email id here,

$to = "user@yourdomain.com";  /// your email ID to receive... not $email  

$email -> refers who is submitting the form...

So, it should be

$to = YOUR EMAIL ID;

Open in new window

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:DS928
ID: 39902500
OK, I need to set the form up so that where it says "Friends Email" this where the email goes to.  I am not getting any errors.  It has to work to where whatever email is in the Friends Email field, thats where the email will be sent to.
0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 39902520
Yes, you're correct, then it works... what is the question now?
0
 

Author Comment

by:DS928
ID: 39902529
It doesnt work when i try it.  Put your email in the field on the form and see if you receive it
0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 39902533
first time, it was worked.. now it is not...did you change anything?
0
 

Author Comment

by:DS928
ID: 39902552
$to = $email;

Is this correct?
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 150 total points
ID: 39902620
If you are trying to create a form to send email to others whose email is entered in the form by the user, you are creating a very inviting spam generator.  A malicious spammer can write a simple program that can use your form to send email to thousands of people until your ISP or web host shuts down your account.  Putting a form like that on your site is simply a bad idea.
1

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question