Form submit is not sending an email - html

I'm having a problem with hosting24.com and I have a submit form which doesn't seem to be sending the emails no matter what I try.
This is what I've tried
<section id="contact-full-2" class="dark-bg bg-color1 cover-bg" style="background-image:url(images/bg29.jpg)">
<div class="container">
<h2 class="title">Order Service</h2>
<p class="sep-bottom">Paypal will hold the money until both parties agree to full satisfaction.<br>Lets begin! </p>
<form action="scripts/contact.php" role="form" id="contact_form">
<div class="form-group">
<input type="text" class="form-control" id="contact_name" placeholder="Full name" name="name">
</div>
<div class="form-group">
<input type="email" class="form-control" id="contact_email" placeholder="Email Address" name="email">
</div>
<div class="form-group">
<textarea class="form-control" rows="4" placeholder="Your message or question" id="contact_message" name="message"></textarea>
</div>
<button type="submit" id="contact_submit" data-loading-text="•••" class="btn btn-lg btn-block btn-primary">Order</button>
</form>

If you are on localhost the mail will go to a folder named MailOutput. If you are using free hosting most of the hosts disable the mail() function due to its wide misuse. If you are using a paid hosting service and you have't changed the code from its working condition you may have to contact the host provider. It may be due to some server error. Check if any of the above are applicable to you.
According to your reply. This is because you are using a gmail address in the FROM section of your email. Your server does not allow that to prevent fake emails from being send. So you will have to try the following code
<?php
$to = "someone#example.com";
$message = $_POST['message'];
$body = "From: $name_field\n Message:\n $message";
$subject = "Contact";
$name_field = $_POST['name'];
mail($to,$subject,$body);
?>

Related

How does this HTML block the auto insertion of my email address from chrome?

At first I thought it was some jerk move to make me type my username for added "security" on top of 2FA so I decided to fix it with tampermonkey and remove the autocomplete="off" attribute only to discover that there wasn't one.
Why does Chrome not offer to autofill the email input in this form? This is a link to the site.. But this is the form that is blocking autocomplete on the email address.
<form method="post" class="form-horizontal">
<h1 class="paste-page-header">Log in</h1>
<div class="form-group">
<div class="col-md-24">
<label class="paste-input-label">Email</label>
<div class="paste-input-wrapper">
<input type="text" id="email" name="email" placeholder="Email" tabindex="1" required="true" class="paste-input sl_whiteout" autofocus="autofocus" maxlength="255">
</div>
</div>
</div>
<div class="form-group col-md-24">
<button role="login-button" type="submit" tabindex="2" class="paste-primary-button" data-loading-text="<i class='icon icon-spinner icon-spin'></i>" value="Log in">Next
</button>
</div>
<span class="paste-text">Don’t have an account yet? Sign up for free.</span>
<input inert="" readonly="true" type="password" id="password" name="password" tabindex="50" style="opacity: 0.02;" aria-label="This is a hidden password field for compatibility with password managers. Please ignore this field.">
<input type="hidden" name="g" value="/console/sms/dashboard?" class="sl_whiteout">
<input type="hidden" name="t" value="182b71c36e3bb0a0a788ab671fbe875c7b46602de5f49fb3e441645b8848a76a" class="sl_whiteout">
<input type="hidden" name="CSRF" value="2869689c41323f2456ec6558c8ee7f3e4c409eda3bbed69bf10228f752a293e4" class="sl_whiteout">
</form>
After you type your email address, it will allow you to autocomplete the password, it's just this field that is a problem. And I tried this:
> x = document.getElementById('email')
<input type=​"text" id=​"email" name=​"email" placeholder=​"Email" tabindex=​"1" required=​"true" class=​"paste-input sl_whiteout" autofocus=​"autofocus" maxlength=​"255">​
> x = document.getElementById('email')
x.autocomplete
''
So, they aren't disabling it with JS (at least not in any way that I can see.....
I'm asking so that I don't make this mistake on any of my sites and because I'm really curious how they pulled this off.

Trouble Sending Mail From AWS S3

I am new to aws and php.
I am running into a problem trying to setup a basic send form on a static amazon s3 site.
Error
405 Method Not Allowed
Code: MethodNotAllowed
Message: The specified method is not allowed against this resource.
Method: POST
ResourceType: OBJECT
RequestId: B41697D6C61AFFCE
HostId: imaELAWJKISLaPfU1tAbhFaIPAgoRxoUsU7JMcc/x9MSS5SOrU6LiW8sVuS4jTw+d2SdWdbjHQ4=
PHP
<?php $name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$formcontent="From: $name \n Message: $message";
$recipient = "support#website.com";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!";
?>
HTML
<form method="post" action="#">
<div class="fields">
<div class="field half">
<label for="name">Name</label>
<input type="text" name="name" id="name" />
</div>
<div class="field half">
<label for="email">Email</label>
<input type="text" name="email" id="email" />
</div>
<div class="field">
<label for="message">Message</label>
<textarea name="message" id="message" rows="5"></textarea>
</div>
</div>
<ul class="actions">
<li>Send Message</li>
</ul>
</form>
Can you point me in the right direction?
PHP is not static. You can only serve static resources from S3. You can't run PHP code on S3.

Adding destination email to contact form

I have a contact form at codepen.io, but it is not working. I don't know where I must put the email address that messages will be sent to.
<form class="cf">
<div class="half left cf">
<input type="text" id="input-name" placeholder="Name">
<input type="email" id="input-email" placeholder="Email address">
<input type="text" id="input-subject" placeholder="Subject">
</div>
<div class="half right cf">
<textarea name="message" type="text" id="input-message" placeholder="Message"></textarea>
</div>
<input type="submit" value="Submit" id="input-submit">
</form>
Thanks in advance for any help.
If you just want a really basic form to send an email, you can set the form action to "mailto:user#email.com". This will open the users default mail client and populate the subject and body with the contents of inputs named "subject" and "body" in the form. The form itself won't send email though - you would need PHP for that.

HTTP POST to web login form. Joomla, INVALID TOKEN

I am trying to create a HTTP POST to a joomla web login form for a web page.
I used this before and I am not new to this but I am stumped, I cannot get any response other than 'invalid token'
The purpose of this is to have a POST that I can use for a mobile application to 'remember' the password as a temporary solution.
I HAVE used Charles to check the difference between the HTTP Requests and I see no difference between if I use the login form manually and if I use a POST in the URL
My Request is
http://www.example.com/member-login?task=user.login&username=SECRET&password=SECRET&return=aW5kZXgucGhwP29wdGlvbj1jb21fdXNlcnMmdmlldz1wcm9maWxl&1132a16eb61f5659e8ff62fb935f6037=1
The HTML code is
<form action="/member-login?task=user.login" method="post" class="form-horizontal" name="login_form">
<div class="joomla_login">
<fieldset class="input">
<h2>Login</h2>
<p>Login using the email address and the password that you used when you registered.</p>
<p>
<span class="add-on">
<label id="username-lbl" for="username" class=" required">User Name<span class="star"> *</span></label> </span>
</p>
<div class="controls">
<input type="text" name="username" id="username" value="" class="validate-username required" size="25"/> </div>
<p>
<span class="add-on">
<label id="password-lbl" for="password" class=" required">Password<span class="star"> *</span></label> </span>
</p>
<div class="controls">
<input type="password" name="password" id="password" value="" class="validate-password required" size="25"/> </div>
<div style="text-align: center; padding-top: 20px; padding-bottom: 20px;">
<button type="submit" class="btn btn-primary dummy-button" >Log in</button>
</div>
<input type="hidden" name="return" value="aW5kZXgucGhwP29wdGlvbj1jb21fdXNlcnMmdmlldz1wcm9maWxl" />
<input type="hidden" name="1132a16eb61f5659e8ff62fb935f6037" value="1" /> </fieldset>
</div>
</form>
Thanks in advance
Try this,
In the Joomla installation site , you have to create a external script(file). the access the Framework there with following code.
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(__FILE__) );//this is when we are in the root
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$mainframe = JFactory::getApplication('site');
$mainframe->initialise();
Now you will be able to use all Joomla libraries and functions on the page.
simple check your login details with following codes.
$credentials['username'] = $data['username']; //user entered name
$credentials['password'] = $data['password']; //users entered password
$app = JFactory::getApplication();
$error = $app->login($credentials, $options);
if (!JError::isError($error)) {
// login success
}
else{
//Failed attempt
}
Make sure this script is available in public access so pass any secret key to access only with your additional encrypted parameter.
Hope it helps..

html help on my contact form please?

I need some help, I'm building a website for a good friend and I need some help with the contact form. I found the code online but it's not working correctly. It sends the e-mail but not all the forms correctly, and doesn't send the picture. Also, when I send the form, it should link to the page contactus.html, but the link doesn't seem to work either. Can anyone help correct this code, this would help SO much. Thank you so, so much.
Here is the HTML for the contact form:
<div id="stylized" class="myform">
<form id="form" id="form" action="mail.php" method="POST">
<label>Name
<span class="small">Add your name</span>
</label>
<input type="text" name="name">
<label>Address
<span class="small">Add your home address</span>
</label>
<input type="text" name="address">
<label>Phone
<span class="small">Add a Phone Number</span>
</label>
<input type="text" name="phone">
<label>E-mail
<span class="small">Enter a valid E-mail</span>
</label>
<input type="text" name="email">
<label>Timeline
<span class="small">Range for your project</span>
</label>
<input type="text" name="timeline">
<label>Photo
<span class="small">Upload current picture</span>
</label>
<input type="file" name="photo">
<label>Description
<span class="small">Type Your Project Description</span>
</label>
<textarea name="message" rows="6" cols="25"></textarea>
<button type="submit" value="Send" style="margin-top:15px;">Submit</button>
<div class="spacer"></div>
</form>
</div>
And here is mail.php, which is supposed to help make the form work. I think here is where the problem is:
<?php $name = $_POST['name'];
$address = $_POST['address'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$timeline = $_POST['timeline'];
$description = $_POST['description'];
$formcontent="From: $name \n Message: $message";
$recipient = "blanger#hawaii.edu";
$subject = "New Project Request from 2DadsDB.com";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!" . " -" . "<a href='contactus.html'>Go Back</a>";
?>
As Blender pointed out the code is very insecure. It's easy for malicious content to be inserted. Also there's no reference in the mail.php to "photo"
$fileImage = $_POST['photo'];
You'll need to use a script to upload and store the photo I believe. It's best too look at a tutorial or complete source instead of building from scratch.
The mail() function is good for only message sending.
To send an image First you need to upload your photo to the server To upload an image.
To send an image using mail() first attach your photo from server to mail() PHP e-mail attachment script
And use $name = mysql_real_escape_string(strip_tags($_POST['name']));
for each post like name,e-mail etc., for security purpose.
You should sanitize your imputs.Use mysql_real_escape_string or stripslashes function on each of the $_POST.
$user = mysql_real_escape_string($_POST['user']);