Page 1 of 1

Help, coupon generator vqmod xml won't send mail

Posted: Thu Jul 10, 2014 4:03 am
by openminds
Maybe someone can tell me what's wrong here? Everything is working but it won't send out the email.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<modification>
	<id>Generate Coupon on Registration</id>
	<version>1.0.0</version>
	<vqmver>2.3.0</vqmver>
	<author>Bhavin Lashkari a.k.a JackLB</author>
	<file name="catalog/controller/account/register.php">
		<operation>
			<search position="after"><![CDATA[
			$this->model_account_customer->addCustomer($this->request->post);
			]]>
			</search>
			<add><![CDATA[
			$config_lbcoupon = $this->config->get( 'lbcoupon_vibhag' );
			$lbcoupon_type = $config_lbcoupon['discount_type'];
			$lbcoupon_amount = (empty($config_lbcoupon['discount_amount'])) ? '0' : $config_lbcoupon['discount_amount'];
			$lbcoupon_duration = (empty($config_lbcoupon['discount_duration'])) ? '15' : $config_lbcoupon['discount_duration'];
			if($config_lbcoupon['status']) {
				$couponcode = substr(number_format(time() * rand(),0,'',''),0,10);
				$couponcode = 'NEW_REG'.$couponcode;
				$this->db->query("INSERT INTO " . DB_PREFIX . "coupon SET name = 'New Reg Dis " . $this->request->post['email'] . "', code = '" . $couponcode . "', discount = '" . $lbcoupon_amount . "', type = '" . $lbcoupon_type . "', total = '100.0000', logged = '1', shipping = '0', date_start = NOW(), date_end = CURDATE() + INTERVAL $lbcoupon_duration DAY, uses_total = '1', uses_customer = '1', status = '1', date_added = NOW()");
				if($lbcoupon_type == 'F') {
					//$message  = sprintf('You can take Discount 5 USD . Just Appy this Coupon code : '.$couponcode, $this->config->get('config_name')) . "\n\n";
					$message  = "You can take USD $lbcoupon_amount Discount on any purchase". "\n\n";
					$message .= "Just Appy this Coupon code : $couponcode";
				} else {
					$message  = "You can take $lbcoupon_amount % Discount on any purchase". "\n\n";
					$message .= "Just Appy this Coupon code : $couponcode";
				}
				$subject = sprintf('Thanks for registering with us, here is your discount ', $this->config->get('config_name'));
				
				$to = $this->request->post['email'];
				$sender_name = $this->config->get('config_name');
				$sender_email = $this->config->get('config_email');
				

				$headers   = array();
				$headers[] = "MIME-Version: 1.0";
				$headers[] = "Content-type: text/plain; charset=iso-8859-1";
				$headers[] = "From: $sender_name <$sender_email>";
				$headers[] = "Bcc: Admin <admin@oldlamp.com>";
				$headers[] = "Reply-To: $to <$sender_email>";
				$headers[] = "Subject: {$subject}";
				$headers[] = "X-Mailer: PHP/".phpversion();
				
				mail($to, $subject, $message, implode("\r\n", $headers));

			}
			]]></add>
		</operation>

Re: Help, coupon generator vqmod xml won't send mail

Posted: Thu Jul 10, 2014 10:17 pm
by openminds
Nevermind, I figured it out. Disregard.