Post by npws » Tue Dec 15, 2009 12:21 am

Steps to reproduce issue:

1. Log into Admin panel
2. Go to Customers > Order
3. Select any order
4. Change "Status" field, select "Notify Customer", enter anything into "Comments"
5. Update order

The issue: the customer does not receive any notification / email.

New member

Posts

Joined
Tue Jul 28, 2009 10:09 pm

Post by Qphoria » Tue Dec 15, 2009 12:55 am

This is particular to people's servers.. not a blanket bug. It works fine for most people. It is just those who have issues with the mail class right now. There are other posts about that.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by npws » Tue Dec 15, 2009 12:58 am

Qphoria wrote:This is particular to people's servers.. not a blanket bug. It works fine for most people. It is just those who have issues with the mail class right now. There are other posts about that.
All other email notifications work perfectly- what could make this one script function incorrectly?

I don't think this is the case.. unless it has its own mail class.

Would someone be so kind as to test this feature on their own system and let me know if it works???

New member

Posts

Joined
Tue Jul 28, 2009 10:09 pm

Post by npws » Thu Dec 17, 2009 10:00 pm

This one is still an issue for me... I don't believe it is an issue on my system alone, because as I stated- all emails work fine, except for this one.

Thanks.

New member

Posts

Joined
Tue Jul 28, 2009 10:09 pm

Post by Qphoria » Thu Dec 17, 2009 10:40 pm

From what i can gather... it comes down to content of the email.. I'm not sure which bit, but typically in these situations, the contact form works as it is simple text... perhaps the order email has some line breaks or characters that cause it to choke for some. It has been an ongoing research issue, but already there have been many class rewrites in the past few versions.

Still, many of us do not see any problems. So it is still one of the big mysteries of life.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by npws » Sat Dec 19, 2009 1:50 am

Qphoria wrote:From what i can gather... it comes down to content of the email.. I'm not sure which bit, but typically in these situations, the contact form works as it is simple text... perhaps the order email has some line breaks or characters that cause it to choke for some. It has been an ongoing research issue, but already there have been many class rewrites in the past few versions.

Still, many of us do not see any problems. So it is still one of the big mysteries of life.
Hey, Q... I was wondering:

I bought a module (RSS Google Base Feed) from your website. Could you test this on my order, in your admin panel?? It should only take a couple minutes, and it'd confirm or debunk this issue, entirely (if it works, the error is not with OC.. if it doesn't work, we've found a bug).

I really appreciate your help... you're the man!

New member

Posts

Joined
Tue Jul 28, 2009 10:09 pm

Post by TomGraves » Sat Dec 19, 2009 10:25 pm

I just updated and order on www.countryfreezers.com using GoDaddy as a host and the email worked fine.

Newbie

Posts

Joined
Wed Dec 02, 2009 2:00 am

Post by Qphoria » Sat Dec 19, 2009 10:40 pm

npws wrote:Could you test this on my order, in your admin panel?? It should only take a couple minutes, and it'd confirm or debunk this issue, entirely (if it works, the error is not with OC.. if it doesn't work, we've found a bug).
Ok i just sent an update to you yesterday

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by npws » Wed Dec 23, 2009 3:28 am

Qphoria wrote:
npws wrote:Could you test this on my order, in your admin panel?? It should only take a couple minutes, and it'd confirm or debunk this issue, entirely (if it works, the error is not with OC.. if it doesn't work, we've found a bug).
Ok i just sent an update to you yesterday
I just checked and I do not have any emails from you in my inbox.

New member

Posts

Joined
Tue Jul 28, 2009 10:09 pm

Post by npws » Wed Dec 23, 2009 3:29 am

TomGraves wrote:I just updated and order on http://www.countryfreezers.com using GoDaddy as a host and the email worked fine.
Which version of OpenCart do you use? Also, do you use SMTP mailer or normal?

New member

Posts

Joined
Tue Jul 28, 2009 10:09 pm

Post by npws » Wed Jan 06, 2010 1:28 am

Qphoria wrote:
npws wrote:Could you test this on my order, in your admin panel?? It should only take a couple minutes, and it'd confirm or debunk this issue, entirely (if it works, the error is not with OC.. if it doesn't work, we've found a bug).
Ok i just sent an update to you yesterday
Any updates?

As stated, I think this proves the issue is not just with my system... you sent me an update, and it never came through. Though, I was able to receive every other email you've ever sent to me.

New member

Posts

Joined
Tue Jul 28, 2009 10:09 pm

Post by dbstr » Wed Jan 06, 2010 1:31 am

It works for me, so it's not a global problem.

Request Reviews v1.0 released.


Active Member

Posts

Joined
Sun Aug 30, 2009 12:20 am

Post by Qphoria » Wed Jan 06, 2010 2:49 am

hmm but most people get the emails I sent. I just sent one to myself from my site and i got it. Maybe its just going to spam.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by npws » Wed Jan 06, 2010 2:59 am

Qphoria wrote:hmm but most people get the emails I sent. I just sent one to myself from my site and i got it. Maybe its just going to spam.
I just got one from you (I assume you just sent it today) and it came through with a bunch of garbled HTML attached to it.

There is obviously an issue.

As for the people saying that theirs works so it must not be an issue- you are not helping at all because you are not providing any information. Are you using SMTP or PHPMail? What OC version are you using? Etc...

New member

Posts

Joined
Tue Jul 28, 2009 10:09 pm

Post by Qphoria » Wed Jan 06, 2010 3:20 am

i use the default php mail.. no smtp.
The text i sent was "test test" or something like that
are you opening it in outlook?

the one i sent to my gmail came out exactly as typed.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Qphoria » Wed Jan 06, 2010 4:23 am

Looks like it was sent to you in html format but your email client read it as text.
The code shows:

Code: Select all

<html dir="ltr" lang="en">
<head>
<title>test qphoric domain</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body><p>this is a test from Q</p></body>
</html>
which does exclaim that the content is text/html format, so that would tell me the email client can't read it properly

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by npws » Wed Jan 06, 2010 4:52 am

Qphoria wrote:i use the default php mail.. no smtp.
The text i sent was "test test" or something like that
are you opening it in outlook?

the one i sent to my gmail came out exactly as typed.
I replied to the email and included the original, so you could see what it looks like. GMail must have parsed out the bad info, but the email was sent with Meta tags and an HTML header. Please check your email and let me know what you think. Thanks again for all the help!

New member

Posts

Joined
Tue Jul 28, 2009 10:09 pm

Post by Qphoria » Wed Jan 06, 2010 5:19 am

Yes, read the post above your last one.. I show it here

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by ckpepper02 » Sat Jan 23, 2010 12:19 am

Any resolution to this yet?? I'm having the same issue. Emails are not going out from the Update order OR the Mail section of the Admin panel. I CAN send emails from my server though, as I posted a test emailer using PHP on my site, and I get the emails just fine.

What do I do???

User avatar
New member

Posts

Joined
Wed Jul 22, 2009 8:35 pm

Post by Daniel » Sat Jan 23, 2010 12:36 am

The problem is that some servers are adding extra \n or \r\n to the mail headers. the server is the problem not opencart.

try replacing the mail class with this and tell me what happens.

Code: Select all

<?php
final class Mail {
	protected $to;
	protected $from;
	protected $sender;
	protected $subject;
	protected $text;
	protected $html;
	protected $attachments = array();
	public $protocol = 'mail';
	public $hostname;
	public $username;
	public $password;
	public $port = 25;
	public $timeout = 5;
	public $charset = 'utf-8';
	public $newline = "\n";
	public $crlf = "\r\n";
	public $verp = FALSE;
   
	public function setTo($to) {
		$this->to = $to;
	}
   
	public function setFrom($from) {
		$this->from = $from;
	}
	
	public function addheader($header, $value) {
		$this->headers[$header] = $value;
	}
	
	public function setSender($sender) {
		$this->sender = $sender;
	}
	
	public function setSubject($subject) {
		$this->subject = $subject;
	}
	
	public function setText($text) {
		$text = str_replace("\r\n", "\n", $text);
		$text = str_replace("\r", "\n", $text);
		$text = str_replace("\n", $this->newline, $text);
		
		$this->text = $text;
	}
	
	public function setHtml($html) {
		$html = str_replace("\r\n", "\n", $html);
		$html = str_replace("\r", "\n", $html);
		$html = str_replace("\n", $this->newline, $html);
		
		$this->html = $html;
	}
	
	public function addAttachment($attachment) {
		if (!is_array($attachment)) {
			$this->attachments[] = $attachment;
		} else{
			$this->attachments = array_merge($this->attachments, $attachment);
		}
	}
	
	public function send() {   
		if (!$this->to) {
			exit('Error: E-Mail to required!');
		}
	
		if (!$this->from) {
			exit('Error: E-Mail from required!');
		}
	
		if (!$this->sender) {
			exit('Error: E-Mail sender required!');
		}
	
		if (!$this->subject) {
			exit('Error: E-Mail subject required!');
		}
	
		if ((!$this->text) && (!$this->html)) {
			exit('Error: E-Mail message required!');
		}
	
		if (is_array($this->to)) {
			$to = implode(',', $this->to);
		} else {
			$to = $this->to;
		}
	
		$boundary = '----=_NextPart_' . md5(time()); 
	
		$header = '';
	
		if ($this->protocol != 'mail') {
			$header .= 'To: ' . $to . $this->newline;
			$header .= 'Subject: ' . $this->subject . $this->newline;
		}
	
		$header .= 'From: ' . $this->sender . '<' . $this->from . '>' . $this->newline;
		$header .= 'Reply-To: ' . $this->sender . '<' . $this->from . '>' . $this->newline;   
		$header .= 'Return-Path: ' . $this->from . $this->newline;
		$header .= 'X-Mailer: PHP/' . phpversion() . $this->newline; 
		$header .= 'MIME-Version: 1.0' . $this->newline;
		$header .= 'Content-Type: multipart/mixed; boundary="' . $boundary . '"' . $this->newline; 
	
		if (!$this->html) {
			$message  = '--' . $boundary . $this->newline; 
			$message .= 'Content-Type: text/plain; charset="utf-8"' . $this->newline;
			$message .= 'Content-Transfer-Encoding: 8bit' . $this->newline . $this->newline;
			$message .= $this->text . $this->newline;
		} else {
			$message  = '--' . $boundary . $this->newline;
			$message .= 'Content-Type: multipart/alternative; boundary="' . $boundary . '_alt"' . $this->newline . $this->newline;
			$message .= '--' . $boundary . '_alt' . $this->newline;
			$message .= 'Content-Type: text/plain; charset="utf-8"' . $this->newline;
			$message .= 'Content-Transfer-Encoding: 8bit' . $this->newline;
		
			if ($this->text) {
				$message .= $this->text . $this->newline;
			} else {
				$message .= 'This is a HTML email and your email client software does not support HTML email!' . $this->newline;
			}   
		
			$message .= '--' . $boundary . '_alt' . $this->newline;
			$message .= 'Content-Type: text/html; charset="utf-8"' . $this->newline;
			$message .= 'Content-Transfer-Encoding: 8bit' . $this->newline . $this->newline;
			$message .= $this->html . $this->newline;
			$message .= '--' . $boundary . '_alt--' . $this->newline;      
		}
	
		foreach ($this->attachments as $attachment) { 
			$filename = basename($attachment); 
			$handle = fopen($attachment, 'r');
			$content = fread($handle, filesize($attachment));
	
			fclose($handle); 
	
			$message .= '--' . $boundary . $this->newline;
			$message .= 'Content-Type: application/octetstream' . $this->newline;   
			$message .= 'Content-Transfer-Encoding: base64' . $this->newline;
			$message .= 'Content-Disposition: attachment; filename="' . $filename . '"' . $this->newline;
			$message .= 'Content-ID: <' . $filename . '>' . $this->newline . $this->newline;
			$message .= chunk_split(base64_encode($content));
		} 
	
		if ($this->protocol == 'mail') {
			ini_set('sendmail_from', $this->from);
	
			mail($to, $this->subject, $message, $header); 
		} elseif ($this->protocol == 'smtp') {
			$handle = fsockopen($this->hostname, $this->port, $errno, $errstr, $this->timeout);   
	
			if (!$handle) {
				error_log('Error: ' . $errstr . ' (' . $errno . ')');
			} else {
				if (substr(PHP_OS, 0, 3) != 'WIN') {
					socket_set_timeout($handle, $this->timeout, 0);
				}
		
				while ($line = fgets($handle, 515)) {
					if (substr($line, 3, 1) == ' ') {
						break;
					}
				}
		
				if (substr($this->hostname, 0, 3) == 'tls') {
					fputs($handle, 'STARTTLS' . $this->crlf);
				
					while ($line = fgets($handle, 515)) {
						$reply .= $line;
					
						if (substr($line, 3, 1) == ' ') {
							break;
						}
					}
		
					if (substr($reply, 0, 3) != 220) {
						error_log('Error: STARTTLS not accepted from server!');
					}               
				}
		
				if (!empty($this->username)  && !empty($this->password)) {
					fputs($handle, 'EHLO ' . getenv('SERVER_NAME') . $this->crlf);
				
					$reply = '';
				
					while ($line = fgets($handle, 515)) {
						$reply .= $line;
				
						if (substr($line, 3, 1) == ' ') {
							break;
						}
					}
		
					if (substr($reply, 0, 3) != 250) {
						error_log('Error: EHLO not accepted from server!');
					}
		
					fputs($handle, 'AUTH LOGIN' . $this->crlf);
		
					$reply = '';
		
					while ($line = fgets($handle, 515)) {
						$reply .= $line;
					
						if (substr($line, 3, 1) == ' ') {
							break;
						}
					}
		
					if (substr($reply, 0, 3) != 334) {
						error_log('Error: AUTH LOGIN not accepted from server!');
					}
		
					fputs($handle, base64_encode($this->username) . $this->crlf);
		
					$reply = '';
		
					while ($line = fgets($handle, 515)) {
						$reply .= $line;
						
						if (substr($line, 3, 1) == ' ') {
							break;
						}
					}
		
					if (substr($reply, 0, 3) != 334) {
						error_log('Error: Username not accepted from server!');
					}            
		
					fputs($handle, base64_encode($this->password) . $this->crlf);
		
					$reply = '';
		
					while ($line = fgets($handle, 515)) {
						$reply .= $line;
					
						if (substr($line, 3, 1) == ' ') {
							break;
						}
					}
		
					if (substr($reply, 0, 3) != 235) {
						error_log('Error: Password not accepted from server!');               
					}   
				} else {
					fputs($handle, 'HELO ' . getenv('SERVER_NAME') . $this->crlf);
		
					$reply = '';
		
					while ($line = fgets($handle, 515)) {
						$reply .= $line;
					
						if (substr($line, 3, 1) == ' ') {
							break;
						}
					}
		
					if (substr($reply, 0, 3) != 250) {
						error_log('Error: HELO not accepted from server!');
					}            
				}
		
				fputs($handle, 'MAIL FROM: <' . $this->from . '>' . $this->crlf);
		
				$reply = '';
				
				while ($line = fgets($handle, 515)) {
					$reply .= $line;
				
					if (substr($line, 3, 1) == ' ') {
						break;
					}
				}
		
				if (substr($reply, 0, 3) != 250) {
					error_log('Error: MAIL FROM not accepted from server!');
				}
		
				if (!is_array($this->to)) {
					fputs($handle, 'RCPT TO: <' . $this->to . '>' . $this->crlf);
				
					$reply = '';
				
					while ($line = fgets($handle, 515)) {
						$reply .= $line;
				
						if (substr($line, 3, 1) == ' ') {
							break;
						}
					}
		
					if ((substr($reply, 0, 3) != 250) && (substr($reply, 0, 3) != 251)) {
						error_log('Error: RCPT TO not accepted from server!');
					}         
				} else {
					foreach ($this->to as $recipient) {
						fputs($handle, 'RCPT TO: <' . $recipient . '>' . $this->crlf);
		
						$reply = '';
		
						while ($line = fgets($handle, 515)) {
							$reply .= $line;
							
							if (substr($line, 3, 1) == ' ') {
								break;
							}
						}
		
						if ((substr($reply, 0, 3) != 250) && (substr($reply, 0, 3) != 251)) {
							error_log('Error: RCPT TO not accepted from server!');
						}                  
					}
				}
				
				fputs($handle, 'DATA' . $this->crlf);
				
				$reply = '';
					
				while ($line = fgets($handle, 515)) {
					$reply .= $line;
					
					if (substr($line, 3, 1) == ' ') {
						break;
					}
				}
			
				if (substr($reply, 0, 3) != 354) {
					error_log('Error: DATA not accepted from server!');
				}
			
				fputs($handle, $header . $message . $this->crlf);
				fputs($handle, '.' . $this->crlf);
			
				$reply = '';
			
				while ($line = fgets($handle, 515)) {
					$reply .= $line;
				
					if (substr($line, 3, 1) == ' ') { 
						break;
					}
				}
			
				if (substr($reply, 0, 3) != 250) {
					error_log('Error: DATA not accepted from server!');
				}
			
				fputs($handle, 'QUIT' . $this->crlf);
				
				$reply = '';
				
				while ($line = fgets($handle, 515)) {
					$reply .= $line;
				
					if (substr($line, 3, 1) == ' ') {
						break;
					}
				}
			
				if (substr($reply, 0, 3) != 221) {
					error_log('Error: QUIT not accepted from server!');
				}         
			
				fclose($handle);
			}
		}
	}
}
?>

also pm me your ftp details. i would like to do some testing on your server to see if i can fix this problem permanently.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm
Who is online

Users browsing this forum: No registered users and 75 guests