Solved

Trying To Send Email from variable

Posted on 2014-03-03
9
286 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
  • 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

856 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