There is an angularjs contact form example 
<http://www.phpcodify.com/create-contact-form-using-angularjs-php/> you can 
follow this and then solve your problem. i hope it will help you.




On Tuesday, June 13, 2017 at 12:42:28 PM UTC+3, Raakesh Bandi wrote:
>
> Hi All,
>
> I have created a contact form where i have used angularJs for getting data 
> from form in to objects..and i am trying to send this captured data from 
> input fields and text-area to a particular email..using some simple 
> PHP..logic to send emails..
> how to communicate between PHP and angular data...is there any other way 
> to send email..other than php..i heard of node mailer..i think this node 
> mailer will be too heavy to send a simple mail..
> any suggestion, any pice of code to implement this successfully..
>
> below is my html form code with angular js implemented..under that my php 
> file to send that data to mail 
>
> *Form.html*
>
> <form name="contact_form" id="contact_form" ng-submit="sendDetails()" 
> novalidate method="POST">
> <div class="row">
> <div class="col-sm-12">
> <input type="text" name="fullname" ng-model="contact.fullname" ng-required
> ="true" placeholder="Your name *" minlength="3">
> <div ng-show="contact_form.fullname.$touched && 
> contact_form.fullname.$invalid">
> <small style="text-align:center;color:red;display:block;">Enter a valid 
> First name</small>
> </div>
> </div>
> <div class="col-sm-6">
> <input type="email" name="email" ng-model="contact.email" ng-required=
> "true" placeholder="Your email *">
> <div ng-show="contact_form.email.$touched && contact_form.email.$invalid">
> <small style="text-align:center;color:red;display:block;">Enter a valid 
> Email</small>
> </div>
>
> <input type="number" name="phone_number" ng-model="contact.phone_number" 
> ng-required="true" placeholder="Phone numberrr *">
> <div ng-show="contact_form.phone_number.$touched && 
> contact_form.phone_number.$invalid">
> <small style="text-align:center;color:red;display:block;">Enter a valid 
> Phone Number</small>
> </div>
> </div>
> </div>
> <div class="row">
> <div class="col-sm-12">
> <textarea type="text" name="message" ng-model="contact.message" 
> ng-required="true" cols="30" rows="10" placeholder="type your message ..." 
> minlength="10"></textarea>
> <div ng-show="contact_form.message.$touched && 
> contact_form.message.$invalid">
> <small style="text-align:center;color:red;display:block;">Enter a valid 
> Message</small>
> </div>
> <input type="submit" value="send" ng-disabled="contact_form.$invalid">
> </div>
> </div>
> </form>
>  
>
> ProcessEmail.php
> <?php
> // EDIT THE 2 LINES BELOW AS REQUIRED
> $email_to = "[email protected] <javascript:>";
> $email_subject = "Enquiry Form Details";
> $name = $_REQUEST['contact.fullname']; 
> $email_from = $_REQUEST['contact.email'];
> $phone = $_REQUEST['contact.phone_number']; 
> $message = $_REQUEST['contact.message'];
> $email_message ='<table width="600" border="1" align="center" 
> cellpadding="10" cellspacing="1" 
> style="color:#000000;font-size:1.1em;font-family:arial,helvetica,sans-serif; 
> border:1px solid #ffffff; border-collapse:collapse; font-weight:bold;">
> <tbody>
> <tr>
> <td colspan="2" 
> style="padding:5px;background-color:#4a3a88;color:white;font-size:150%; 
> font-weight:bold; border-bottom:5px solid; border:1px solid 
> black;text-align:center;">Recommend Your Neighbour Store</td>
> </tr>
> <tr>
> <td style="text-align:right;background-color:#4a3a88;color:white; 
> font-weight:bold; border:1px solid black;" width="30%">Name</td>
> <td style="background-color:white;border:1px solid black;">'.$name.'</td>
> </tr>
> <tr>
> <td style="text-align:right;background-color:#4a3a88;color:white; 
> font-weight:bold; border:1px solid black;" width="30%">Email No</td>
> <td style="background-color:white;border:1px solid black;">'.$email_from.
> '</td>
> </tr>
> <tr>
> <td style="text-align:right;background-color:#4a3a88;color:white; 
> font-weight:bold; border:1px solid black;" width="30%">Message</td>
> <td style="background-color:white;border:1px solid black;">'.$message.
> '</td>
> </tr>
> </tbody>
> </table>'; 
> // create email headers
> $headers = 'From: '.$email_from."\r\n".
> $header.='Content-type: text/html; charset=iso-8859-1; 
> Content-Transfer-Encoding =7bit'."\r\n";
> 'Reply-To: '.$email_from."\r\n" .
> 'X-Mailer: PHP/' . phpversion();
> $send = @mail($email_to, $email_subject, $email_message, $headers); 
> if($send) {
> echo '<script> 
> location="some location path";
> alert("Mail Send Successfully...., We will get back to you soon!"); 
> </script>';
> } else {
> echo '<script> 
> location="some location path";
> alert("something went wrong..!"); </script>';
> }
> ?>
>
>
>
>
> Thanks,
> Raakesh
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to