produktie mail naar postmark

This commit is contained in:
2024-08-25 20:26:36 +02:00
parent b600917bd3
commit a2bf022e52
3 changed files with 41 additions and 39 deletions
-1
View File
@@ -19,7 +19,6 @@
$config['charset'] = 'iso-8859-1';
$config['protocol'] = $_ENV['MAIL']['PROTOCOL'];
$config['smtp_host'] = $_ENV['MAIL']['HOST'];
$config['smtp_user'] = $_ENV['MAIL']['SMTP_USER'];
$config['smtp_pass'] = $_ENV['MAIL']['SMTP_PASS'];
+29 -26
View File
@@ -218,33 +218,36 @@ class Login extends MY_Controller {
$data = ['username' => $username, 'password' => $password, 'fullname' => $this->Users_model->get_fullname( $userid )];
$html = $this->load->view( 'emails/newpassword_mail', $data, TRUE );
if( $_ENV['ENVIRONMENT'] == 'production')
{
//Deze code wordt alleen op produktie gebruikt en stuurt de mail
//naar Mailgun via een API (Codeigniter email library wordt niet gebruikt
$mg = Mailgun::create( $_ENV['MAIL']['APIKEY'] );
$mg->messages()->send( $_ENV['MAIL']['DOMAIN'], [
'from' => 'info@monpas.nl',
'to' => $email,
'cc' => 'rfranke@framework-ed.nl',
'subject' => 'Inloggegevens MonPas',
'html' => $html,
'inline' => [
[
'filename' => 'monpasklein.png',
'filePath' => FCPATH . 'css/images/monpasklein.png']
]
] );
}else{
$this->load->library( 'email' );
$this->email->from( 'noreply@framework.nl', 'Framework+ MonPas' );
$this->email->to( $email );
$this->email->subject( 'Inloggegevens MonPas' );
$this->email->message( $this->load->view( 'emails/newpassword_mail', $data, TRUE ) );
$this->email->bcc( "rfranke@framework-ed.nl" );
$this->email->send();
}
$this->Mail_model->sendTheEmail($email, 'Inloggegevens MonPas', $html, "rfranke@framework-ed.nl");
// if( $_ENV['ENVIRONMENT'] == 'production')
// {
// //Deze code wordt alleen op produktie gebruikt en stuurt de mail
// //naar Mailgun via een API (Codeigniter email library wordt niet gebruikt
// $mg = Mailgun::create( $_ENV['MAIL']['APIKEY'] );
// $mg->messages()->send( $_ENV['MAIL']['DOMAIN'], [
// 'from' => 'info@monpas.nl',
// 'to' => $email,
// 'cc' => 'rfranke@framework-ed.nl',
// 'subject' => 'Inloggegevens MonPas',
// 'html' => $html,
// 'inline' => [
// [
// 'filename' => 'monpasklein.png',
// 'filePath' => FCPATH . 'css/images/monpasklein.png']
// ]
// ] );
// }else{
// $this->load->library( 'email' );
//
// $this->email->from( 'noreply@framework.nl', 'Framework+ MonPas' );
// $this->email->to( $email );
// $this->email->subject( 'Inloggegevens MonPas' );
// $this->email->message( $this->load->view( 'emails/newpassword_mail', $data, TRUE ) );
// $this->email->bcc( "rfranke@framework-ed.nl" );
// $this->email->send();
// }
$result['errortekst'] = 'Er is een e-mail gestuurd naar ' . $email . ' met uw nieuwe wachtwoord.';
$result['status'] = TRUE;
+12 -12
View File
@@ -22,22 +22,22 @@ class Mail_model extends MY_Model{
if ( ! is_array( $to ) ) $to = (array) $to;
foreach ( $to as $receiver ){
$mailParts = explode( '@', $receiver );
if (! $mailParts || count($mailParts) < 2) return $result="Er gaat iets fout met e-mail adres ".$receiver;
$mailParts = explode( '@', $receiver );
if (! $mailParts || count($mailParts) < 2)
return $result="Er gaat iets fout met e-mail adres ".$receiver;
// moet dit gebeuren? $this->setmail();
$this->email->to( $receiver );
$this->email->from( 'info@monpas.nl', 'Framework MonPas' );
if ( $cc ) $this->email->bcc( $cc );
$this->email->to( $receiver );
$this->email->from( 'info@monpas.nl', 'Framework MonPas' );
if ( $cc ) $this->email->bcc( $cc );
$this->email->subject( $subject );
$this->email->message( $html );
$this->email->subject( $subject );
$this->email->message( $html );
$sendResult = $this->email->send();
if ( ! $this->email->send() ){
$result = $this->email->print_debugger();
};
if ( ! $sendResult ){
$result = $this->email->print_debugger();
};
}
return $result;