send emsil

This commit is contained in:
dev-chiefworks
2023-04-15 11:31:29 -04:00
parent e20b2bfc1f
commit 79b8160920
6 changed files with 81 additions and 15 deletions
+1 -1
View File
@@ -326,7 +326,7 @@ $(document).ready(function($) {
$.ajax({
type: "POST",
url: 'contact.php',
url: 'contact',
dataType: 'json',
cache: false,
data: $('#contact-form').serialize(),
+12 -8
View File
@@ -47,35 +47,39 @@ class Email extends BaseConfig
*
* @var string
*/
public $SMTPHost;
//public $SMTPHost;
public $SMTPHost= "ssl://smtp.google.com"; //'smtp.google.com';
/**
* SMTP Username
*
* @var string
*/
public $SMTPUser;
//public $SMTPUser;
public $SMTPUser='support@chiefsoft.com';
/**
* SMTP Password
*
* @var string
*/
public $SMTPPass;
//public $SMTPPass;
//public $SMTPPass;
public $SMTPPass='may12002!';
/**
* SMTP Port
*
* @var integer
*/
public $SMTPPort = 25;
//public $SMTPPort = 25;
public $SMTPPort = 465; // 993; //465;587; //
/**
* SMTP Timeout (in seconds)
*
* @var integer
*/
public $SMTPTimeout = 5;
public $SMTPTimeout = 50;
/**
* Enable persistent SMTP connections
@@ -90,7 +94,7 @@ class Email extends BaseConfig
* @var string
*/
public $SMTPCrypto = 'tls';
//public $SMTPCrypto = 'ssl'; // 'tls';
/**
* Enable word-wrap
*
+1
View File
@@ -37,6 +37,7 @@ $routes->get('/', 'Home::index');
$routes->get('/about', 'Home::about');
$routes->get('/services', 'Home::services');
$routes->get('/contact', 'Home::contact');
$routes->post('/contact', 'Home::contactSend');
/*
* --------------------------------------------------------------------
+59
View File
@@ -29,4 +29,63 @@ class Home extends BaseController
$data['page'] = 'contact';
return view('contact',$data);
}
public function contactSend(){
if ($_POST){
log_message('critical', "Post Message -Entered" );
$name = $_POST['name'];
$email= $_POST['email'];
$message= $_POST['comment'];
log_message('critical', "Post Message -Entered".$name );
log_message('critical', "Post Message -Entered".$email );
log_message('critical', "Post Message -Entered".$message );
$message_to_send = "This is the message Ya YA ";
$this->notifyMessage( $message_to_send );
}
return $this->contact();
}
private function notifyMessage( $message_to_send )
{
$data =[];
$to = 'ameye@chiefsoft.com';//Type here the mail address where you want to send
$subject = 'KevKem Site Message';//Write here Subject of Email
$message= $message_to_send; //'Conngrats ! You did it. -- '.rand(1000,9999);//Write the message you want to send
$email = \Config\Services::email();
$config['protocol'] = 'sendmail';
$config['mailPath'] = '/usr/sbin/sendmail';
$config['charset'] = 'iso-8859-1';
$config['wordWrap'] = true;
//$email->initialize($config);
$email->setTo($to);
$email->setFrom('support@chiefsoft.com', 'KevKem Support');//set From
$email->setSubject($subject);
$email->setMessage($message);
if($email->send())
{
//echo 'Email has been Sent.';
log_message('critical', "Email has been Sent" );
$data['msg'] ='All good '.rand(100,9999);
}
else{
// echo 'Something went wrong !';
$data['error'] = $email->printDebugger(['headers']);
log_message('critical', "Something went ERROR --- . ". serialize($data['error']) );
;
log_message('critical', "Something went wrong" );
//log_message('critical',$data );
//print_r($data);
}
return $data;
}
}
+7 -5
View File
@@ -24,8 +24,8 @@
<!-- div class="map">
</div -->
<iframe class="map" src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3314.2214159859145!2d-84.61530898396445!3d33.83240013672915!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x88f522991d3be3cd%3A0x2b1bfc3fdd13919a!2sClay%20Plaza%20Shopping%20Center%2C%204968%20Austell%20Rd%20%23148%2C%20Austell%2C%20GA%2030106!5e0!3m2!1sen!2sus!4v1631456321742!5m2!1sen!2sus" width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy"></iframe>
<!-- <iframe class="map" src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3314.2214159859145!2d-84.61530898396445!3d33.83240013672915!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x88f522991d3be3cd%3A0x2b1bfc3fdd13919a!2sClay%20Plaza%20Shopping%20Center%2C%204968%20Austell%20Rd%20%23148%2C%20Austell%2C%20GA%2030106!5e0!3m2!1sen!2sus!4v1631456321742!5m2!1sen!2sus" width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy"></iframe> -->
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3312.4378219183395!2d-84.59127842321968!3d33.87837637322297!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x88f517c1de7b0dbb%3A0x6a0669a3bb2b4ff!2s3077%20Austell%20Rd%2C%20Marietta%2C%20GA%2030008!5e0!3m2!1sen!2sus!4v1681566409227!5m2!1sen!2sus" width="100%" height="450px" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
<!-- contact box -->
<div class="contact-box">
<div class="container">
@@ -57,8 +57,9 @@
<div class="col-md-6">
<h3 style="font-weight: bold; ">Send us a message</h3>
<form id="contact-form" method="post" action="/contact">
<font color="red"><strong><?=$message?></strong><font>
<form id="contact-form" method="post" action="/contact/">
<div style="color:red"><strong><?=$message?></strong></div>
<div class="text-input">
<div class="float-input">
<input name="name" id="name" type="text" placeholder="name" value="<?=$name?>">
@@ -66,7 +67,7 @@
</div>
<div class="float-input2">
<input name="mail" id="mail" type="text" placeholder="email" value="<?=$mail?>">
<input name="email" id="mail" type="text" placeholder="email" value="<?=$email?>">
<span><i class="fa fa-envelope"></i></span>
</div>
</div>
@@ -104,4 +105,5 @@
<?= $this->endSection() ?>
+1 -1
View File
@@ -326,7 +326,7 @@ $(document).ready(function($) {
$.ajax({
type: "POST",
url: 'contact.php',
url: 'contact',
dataType: 'json',
cache: false,
data: $('#contact-form').serialize(),