dcsimg
www.webdeveloper.com
Results 1 to 4 of 4

Thread: Outgoing E-mails from a Website

Hybrid View

  1. #1
    Join Date
    Dec 2012
    Posts
    6

    Outgoing E-mails from a Website

    Hello, I recently started a new website and I want the user to be able to mail me through a web form.
    I've set the form up and this is the processing, but it does not work. Anyone know what I should do ?

    <?php
    ini_set("SMTP", "mail.*****.com");
    if(isset($_POST['submit'])) {
    $msg = 'Email: ' .$_POST['email'];
    $title = $_POST['title'];
    $email = $_POST['email'];
    $to = ******';
    $picture = $_POST['picture'];

    mail('$to', '$title', '$picture', 'From:' . $email);
    header('location: submitted.php');
    } else {
    header('location: ./index.php');
    exit(0);
    }
    ?>

  2. #2
    Join Date
    Dec 2012
    Posts
    6
    EDIT:
    ini_set("SMTP", "mail.*****.com");
    ini_set("stmp_port", "25");
    ini_set('sendmail_from', '****@***.com');
    if(isset($_POST['submit'])) {
    $msg = 'Email: ' .$_POST['email'];
    $title = $_POST['title'];
    $email = $_POST['email'];
    $to = '*****@hotmail.com';
    $picture = $_POST['picture'];

    mail('$to', '$title', '$picture', 'From:' . $email);
    header('location: submitted.php');
    } else {
    exit(0);
    header('location: ./index.php');
    }
    ?>

    Also tried the other SMTP port, didnt work either. Don't know what to do :/

  3. #3
    Join Date
    May 2003
    Posts
    599
    The most immediate thing I see is enclosing the variables being passed to the mail() function in single quotes.

    ps...use the PHP code tags when posting code, It will help you get more resonses if others see the syntax highlighting instead of a blob of black text.

  4. #4
    Join Date
    Dec 2012
    Posts
    6
    Thanks for the reply but I used PEAR:Mail instead, now it is working. Have a nice day

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles