I am trying to create a php file that alongside other actions, like sending an SMS (which is working fine), the script also needs to send an email (it fails obviously).
Simple as that.
I had some problems trying to require_once the config, startup and library/email files but I fixed it and now I do not get any error, however emails are not sent.
The PHP file runs in the same server and directory with Opencart 1.5 but lets say I want to create a standalone .php file that sends emails.
I do not know how to echo the properties of Mail and Config to know what I need to do so I came here for help.
Code: Select all
<?php $email_address = "firstname.lastname@example.org"; $message = "My Message"; require_once('config.php'); require_once(DIR_SYSTEM . 'startup.php'); $config = new Config(); $mail = new Mail(); $mail->protocol = $config->get('config_mail_protocol'); $mail->parameter = $config->get('config_mail_parameter'); $mail->hostname = $config->get('config_smtp_host'); $mail->username = $config->get('config_smtp_username'); $mail->password = $config->get('config_smtp_password'); $mail->port = $config->get('config_smtp_port'); $mail->timeout = $config->get('config_smtp_timeout'); $mail->setTo($email_address); $mail->setFrom($config->get('config_email')); $mail->setSender("My Store"); $mail->setSubject("My Subject"); $mail->setText($message); $mail->send(); ?>