Jump to content

PHP Mail & SMS Script


Bajki

Recommended Posts

Hello,

so I have input form for feedback with php mail send but i also want to send a sms message to user.

This is html:
<div class="fs-form-wrap" id="fs-form-wrap">

<form id="form" class="fs-form fs-form-full" action="#" method="post" autocomplete="off">
<ol class="fs-fields">
<li>
<label class="fs-field-label fs-anim-upper" for=Name?</label>
<input class="fs-anim-lower" id="q1" name="q1" type="text" placeholder="Name" required/>
</li>
<li>
<label class="fs-field-label fs-anim-upper" for="q2" data-info="Vaild eamil....?</label>
<input class="fs-anim-lower" id="q2" name="q2" type="email" placeholder="email@email.com" required/>
</li>

<li>
<label class="fs-field-label fs-anim-upper" for="q3" data-info="Valid phone number">Phone number...?</label>
<input onkeypress='return event.charCode >= 48 && event.charCode <= 57' class="fs-anim-lower" id="q3" name="q3" type="text" maxlength="10" placeholder="09x-xxx-xxxx" required/>
</li>
<li>
<label class="fs-field-label fs-anim-upper" for="q4" data-info="What do you think about our servise?">Feedback</label>
<textarea class="fs-anim-lower" id="q4" name="q4" placeholder="Feedback.."></textarea>
</li>
</ol><!-- /fs-fields -->
<button class="fs-submit" type="submit" name="submit" id="send" >Send</button>

</form>
</div>


This is php mail:

<?php
if(isset($_POST["submit"])){
//Checking for blank Fields..
if($_POST["q1"]==""||$_POST["q2"]==""||$_POST["q3"]==""||$_POST["q4"]==""){
echo "Fill everything..";
}else{
// Check if the "Sender's Email" input field is filled out
$email=$_POST['q2']; 

// Sanitize e-mail address
$email =filter_var($email, FILTER_SANITIZE_EMAIL);

// Validate e-mail address
$email= filter_var($email, FILTER_VALIDATE_EMAIL);

if (!$email){
echo "Invalid Sender's Email";
}
else{
$subject = $_POST['q3'];

$message = 'Name: ' . $_POST['q1'] . ' Email: ' . $_POST['q2'] . ' Phone Number: ' . $_POST['q3'] . ' Feedback: ' . $_POST['q4'];

$headers = 'From:'. $email . "\r\n"; // Sender's Email


// message lines should not exceed 70 characters (PHP rule), so wrap it
$message = wordwrap($message, 70);

// Send mail by PHP Mail Function
mail("myemail@mydomain.com", $subject, $message, $headers);
echo "Thank you for feedback";
}
}
}
?>

I have public sms getaway on my computer so when user input his phone script make link like this "http://mysmsgetaway.com?PhoneNumber=user-phone-number&Text=message-from-us" and it goes to my getaway..

Thank you

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.