How do I allow users to send me emails?

  • Hello all, a week ago, I was directed to, and I've been following this tutorial, here ( construct.net/en/tutorials/sending-email-construct2-1068 ), but I can't get it to actually send an email. My event sheet and php file images are below... Can someone help me figure this out?

    Event Sheet:

    dropbox.com/s/hzozp8yuxmvidv8/eventsheet1.JPG

    dropbox.com/s/ohsnhhblm0qxrzl/eventsheet2.JPG

    PHP File:

    dropbox.com/s/f1jgy9xc4n14wjt/PHP%20file3.JPG

    index.html Folder File Structure:

    dropbox.com/s/c9mxb4vo7h0vqvh/file%20structure.JPG

    Thanks!

    Tagged:

  • The php file should go into your root folder on the server, it should not be part of C2, it should be saved separately by notepad, and then transferred to the root fold on your server.

    1. save it with notepad.
    2. Send to server via ftp with software like 'filezilla' put it into the root folder of

      affordableconnoiseur.000webhostapp.com/[/li]

  • Did you see the 'index.html Folder File Structure' image I put in my original post?

    I did put the php file into my root (index.html) folder on the server. I believe my issue, is with the code. There must be something in my (event sheet and/or php) code I need to change (probably something very simple), but I don't know what it is...

  • Did you see the 'index.html Folder File Structure' image I put in my original post?

    Are you getting an echo back with the time sent at the bottom of the form ?

    Also It will not work on Localhost(construct preview), you have to export it and put the folder on your server.

    You can check the php for errors, with just running it in the browser.

  • What do you mean by 'getting an echo back'? Do you mean, after I press the 'OK' button, something should show up at the bottom of the form? If that's the case, the answer's no. I did not get (see) any echo at the bottom of the form after attempting to send an email.

    Also, I have already exported it and put the folder on my server (the php form is in the main index.html folder). So the website's up and running, except for the email function.

    Can some please look at teh code in the pictures I posted... The problem has to lie in the code.

    In the php file, it says...

    <?php

    $to = $_POST['email_to'];

    $subject = $_POST['subject'];

    $message = $_POST['message'];

    $headers = 'From: 'moc.elpmaxenng@retsambew . "\r\n" .

    'Reply-To: 'moc.elpmaxenng@retsambew . "\r\n" .

    'X-Mailer: PHP/' . phpversion();

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

    echo "Message sent at ";

    echo date ("h:i:s");

    ?>

    What am I supposed to change, or should I just leave it?

  • What do you mean by 'getting an echo back'? Do you mean, after I press the 'OK' button, something should show up at the bottom of the form? If that's the case, the answer's no. I did not get (see) any echo at the bottom of the form after attempting to send an email.

    Yes you will get a sent time conformation after sending, beneath the button, where it says confirm

    The php looks fine, but if you want to check it for errors run the file directly in the browser, and you should get a response saying "Message sent at (and the time here)".

    I have just checked my original project and it works fine in c2 .

  • Are You are missing the .com in your send and request or is your jpg not wide enough?

    Also its saying that this file is not found on your server

    http://affordableconnoisseur.000webhostapp.com/c2mail.php

  • If the php file's fine, then there must be a problem with the event sheet...

    Yes. There's a .com in the send and request... "http://affordableconnoisseur.000webhostapp.com/c2mail.php"

    Is there anything else it could be, if not a problem with the event sheet?

    If the event sheet code is fine, then what do you mean, "the file is not found on your server"? That doesn't make sense... I definitely have the php file on the server (I just checked Filezilla). Does that mean there's a problem with where the file's located? I have it in the root (index.html) folder...

    You can see my Filezilla website structure, here: dropbox.com/s/w03t1b4fuh30lug/file%20structure3.JPG

  • Just put the php file in the public folder.

    Your c2 project should be in its own folder in the public folder, so just drag the exported c2 folder to the public folder, with filezilla, and call it something other than index.

    see if that works

  • I just tested it. It's still not working.

  • "... call it something other than index."

    I thought the root folder needed to be called index.html.

    Can help me understand, visually, how the file structure should look like?

  • It's possible that your server doesn't support PHP Mail - have you checked that it works outside of Construct?

    Also, does the real address have TLD, it looks cut off in the screenshot of the event sheet

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yes. The 000webhost sever definitely allows for sending emails.

    I just checked the cPanel Settings section:

    dropbox.com/s/qpytnm0hm9mrud2/cPanel.JPG

    Yes, there is a .com at the end of the real address, and in the event sheet. You just can't see it (it's cut off, but it's there).

  • File structure

    You don't have to call your folder index, just call it something like, New Project.

    Have you got any project to run on your server, like a game?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)