Post by SuperJuice » Sun Aug 16, 2009 3:12 pm

This isn't a problem with OpenCart this is a problem with your email provider.

Hotmail has very strict filtering rules, and as such would be dropping the email.

How is it OpenCart's fault that Hotmail is dropping email? OpenCart is delivering it, Hotmail is just discarding it because it's spam filter is so strict.

If you sent an email with just an imbedded image link from any service to Hotmail it will likely get discarded as spam.

I don't have a solution for you, other than perhaps putting more text in the message you send out with the image so there is a higher chance that Hotmail will treat it as a genuine legitimate email.

Also, as a test you can add the OpenCart source address to your trusted list or addressbook in Hotmail and you will most likely see that the email turns up without a problem (this isn't a solution for your customers, but proof that Hotmail is the problem)

Hotmail is like Internet Explorer 6, you can't convince people to stop using it no matter how broken it is.

Active Member

Posts

Joined
Thu Aug 13, 2009 12:06 pm

Post by myopen » Sun Aug 16, 2009 8:46 pm

So I do not understand. What do I need to have in the admin section mail? For example .. now I just tried to send text to another email account (no picture inside) and this is displayed in an account "virgilio.it" (one of the most important of italy):

Code: Select all

<html dir="ltr" lang="en"> <head> <title> test </ title> <meta http-equiv = "Content-Type" content = "text / html; 
charset = UTF-8 "> </ head> <body> <p> test message </ p> </ body> </ html> 
Unlike Hotmail, that the message without an image made me read, because now in an account "virgilio.it" makes me all the code? The strange thing is that the message of successful registration as a customer "and" order product "(always in" virgilio.it ") them to see me very well (no html). Why send your mail (without image) by admin cient to show me the code? To me there is something wrong with fck editor. I can not be afraid to send an email to all subscribers to the news letters and the risk that:
a) some states only the text
b) comes to other html code
c) no other comes

what do you think?

New member

Posts

Joined
Fri Aug 14, 2009 9:27 pm

Post by SuperJuice » Sun Aug 16, 2009 9:17 pm

I think it has nothing to do with the editor.

I can send mail with and without images and can confirm delivery on both ends, the benefit being that I own the boxes so can see the mail path.

You don't seem to realise or appreciate that adding a single image in an img tag in an email will score extremely high in spam filters. The other emails sent out from OpenCart (registration and order) don't have image links in them do they, that is the obvious difference.

Maybe try adding more text to the emails you are sending image links in to hopefully balance out the spam filter?

Or why not just make the emails text, and then have a URL setup on the net people can click to visit.

Lastly, just use a normal email client and attach the image to the email, rather than trying to use an img tag in the email to link to it.

It doesn't matter how 'important' the mail provider is, if they are classing the email you send as spam that's a problem at their end, not yours.

I have tried again to replicate this, and it works 100% as expected, and the mail arrives 100% of the time, image link or no image link.

Maybe you should try it with a mail server you can actually trust that isn't provided by a free provider, and confirm that the mail is getting to the server. Even setup a mail server locally, or use an address local to the server sending the email to confirm that it is leaving OpenCart (for your sake, I am convinced this isn't an OpenCart issue).


-edit-
I just did it again from my 1.3.0 installation and my 1.3.2 installation to 2 different (non FREE) mail servers, both worked 100%

Once again, try it with a destination mailserver you can trust, and not one from a free service. It will show the problem is with spam filtering and not OpenCart.

Send a test email with an embedded image to me
opencart@pixeldrift.net from your admin panel, interested to see if it gets here.

Active Member

Posts

Joined
Thu Aug 13, 2009 12:06 pm

Post by myopen » Sun Aug 16, 2009 10:38 pm

hello .. I have sent 3 email:
1) Text Only
2) with an image. Jpg
3) with an image. Gif

The image that I have sent in your email I have taken from google image and I uploaded on my server.

---------------

What I mean is that it works for me, "mail" in admin of opencart no sense and does not work for what you have explained. Please explain. If for example one of my customer has a free email box (most people have email boxes free), email has to arrive at all. I can not risk it, I as admin, to send newsletters, which will not arrive in email boxes. Before I thought that only by sending the text functioned ... But no. I tried on 3 different servers ... 2 free ... and 1 private pay.

1) on "hotmail" (FREE) comes only with the email text and reads well. Not received the email with your image.
2) on "virgilio.it" (FREE) reaches only the email text, but comes as a html (bad!). Not received the email with images.
3) on "aruba.it" (NOT FREE) the email arrives, but inside the message is read only: Email Message
not support HTML email!

------------------

what I mean is this. most customers that buy online has always FREE email boxes. It does not matter whether free or not free. The email from admin panel to all customers (for the newsletter) needs to get to all! I understand the problem of pictures ... but now comes out that the "mail" to opencart admin panel does not work !!!!!!! even if I use plain text ... I hope you understand me ...

New member

Posts

Joined
Fri Aug 14, 2009 9:27 pm

Post by SuperJuice » Mon Aug 17, 2009 6:33 am

I'm pretty close to giving up on this thread.. mainly because you seem to insist that OpenCart has to ensure mail gets to all providers, when this can't be done.. so you are wasting your time asking for this. You can't guarantee that a mail provider is going to deliver mail, even if they give you a 250 response code.. this is just fact.

In other news though, I received 1 of the 3 emails. So interested to know what you are doing differently.

The contents of the email I received was:
-----------
test text

mysite
-----------

mysite was a link to -> www.msn.com

Haven't received any other email yet.

Active Member

Posts

Joined
Thu Aug 13, 2009 12:06 pm

Post by myopen » Mon Aug 17, 2009 6:56 am

through the same .. you were very kind. I'll see what to do ... thanks

New member

Posts

Joined
Fri Aug 14, 2009 9:27 pm

Post by Daniel » Mon Aug 17, 2009 8:10 am

This should not be hard to understand!

you email prover is stopping the mails with images because it thinks its spam!

if it is detected that it is coming web server and not a mail client it probably thinks you are sending spam.

npot report this in the forums! this is not an opencart bug.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by myopen » Mon Aug 17, 2009 8:49 pm

Yes daniel ... is not a bug. I only asked why not arrived emails that I sent from the admin panel to customers. Opencart is a beautiful software ... Thank you for the good work.

for those who read the post ... it is NOT A BUG!

New member

Posts

Joined
Fri Aug 14, 2009 9:27 pm

Post by joaisbn » Wed Sep 09, 2009 4:01 am

I had the same problem, caused by anti-spam filter. The messages with images were going to the spam box.

Newbie

Posts

Joined
Thu Aug 20, 2009 3:56 am

Post by JeffBeck35 » Fri Jul 01, 2011 4:41 am

Hi All,
I have been facing this problem for 1 week and I still could not find a solution. (OC version 1.4.9.4) I can send e-mails that include both text and image to hotmail, yahoo, gmail, aol, mail.mywebsite.com/mail, windows mail, outlook and outlook express via the changes that I made mail.php, but for mozilla thunderbird I cannot do the same. The text is sent, but the image cannot be viewed. Is there anyone who knows the solution to this problem? I appreciate your urgent help. Superjuice advised the right application, but to all e-mail addresses ithe image is sent in "cid" code format and the original name of the image file is changed to digit and letters. You can see this in the attached image.

http://imageshack.us/photo/my-images/801/20670739.png/


the changes that I made in mail.php file are:

Old Code:

Code: Select all

$header .= 'Content-Type: multipart/mixed; boundary="' . $boundary . '"' . $this->newline;
New Code:

Code: Select all

$header .= 'Content-Type: multipart/mixed; boundary="' . $boundary . '"' . $this->newline;
$header .= $this->newline; 
You will not send empty e-mails with the code that I gave. the text and images in your e-mails will be viewed in all e-mail softwares except mozilla thunderbird. We need to solve the issue for mozilla thunderbird.

My Mail.php File:

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 $newline = "\n";
	public $crlf = "\r\n";
	public $verp = FALSE;
	public $parameter = '';

	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 = html_entity_decode($sender);
	}

  public function setSubject($subject) {
      $this->subject = '=?UTF-8?B?' . base64_encode($subject) . '?=';
   }

	public function setText($text) {
		$this->text = $text;
	}

	public function setHtml($html) {
		$this->html = $html;
	}

	public function addAttachment($file, $filename = '') {
		if (!$filename) {
			$filename = basename($file);
		}

		$this->attachments[] = array(
			'filename' => $filename,
			'file'     => $file
		);
	}

	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 .= 'Date: ' . date("D, d M Y H:i:s O") . $this->newline;
		//$header .= 'From: "' . $this->sender . '" <' . $this->from . '>' . $this->newline;
		//$header .= 'From: ' . $this->sender . '<' . $this->from . '>' . $this->newline;
		$header .= 'From: ' . '=?UTF-8?B?'.base64_encode($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;
		$header .= $this->newline; 

		if (!$this->html) {
			$message  = '--' . $boundary . $this->newline;
			$message .= '' . $this->newline;
			$message .= '' . $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->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) { 
         if (file_exists($attachment['file'])) {
            $handle = fopen($attachment['file'], 'r');
            $content = fread($handle, filesize($attachment['file']));
      
            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="' . basename($attachment['filename']) . '"' . $this->newline;
            $message .= 'Content-ID: <' . basename($attachment['filename']) . '>' . $this->newline . $this->newline;
            $message .= chunk_split(base64_encode($content));
         }
      }

		$message .= '--' . $boundary . '--' . $this->newline;

		if ($this->protocol == 'mail') {
			ini_set('sendmail_from', $this->from);

			if ($this->parameter) {
				mail($to, '=?UTF-8?B?'.base64_encode($this->subject).'?=', $message, $header, $this->parameter);
			} else {
				mail($to, '=?UTF-8?B?'.base64_encode($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!');
					}
				}

				if ($this->verp) {
					fputs($handle, 'MAIL FROM: <' . $this->from . '>XVERP' . $this->crlf);
				} else {
					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);
			}
		}
	}
}
?>

I am waiting for your solution offers.

Many thanks
Jeff
O0

Newbie

Posts

Joined
Wed Jan 27, 2010 7:17 pm

Post by JeffBeck35 » Fri Jul 01, 2011 6:26 am

Yes Yes Yes!

I Solved Problem! :)

vuuuuuvvvvvvvv! O0

Solved :

1- OC Version 1.4.9.4

2 - Mail Php Files; ( system/library/mail.php )

16. - 17.

Code: Select all

	public $newline = "\n";
	public $crlf = "\r\n";
37. - 38.

Code: Select all

  public function setSubject($subject) {
      $this->subject = '=?UTF-8?B?' . base64_encode($subject) . '?=';
   }
105.106.

Code: Select all

		$header .= 'Content-Transfer-Encoding: 8bit' . $this->newline;		
		$header .= $this->newline; 
Must be...

And my Mail.php file :

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 $newline = "\n";
	public $crlf = "\r\n";
	public $verp = FALSE;
	public $parameter = '';

	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 = html_entity_decode($sender);
	}

  public function setSubject($subject) {
      $this->subject = '=?UTF-8?B?' . base64_encode($subject) . '?=';
   }

	public function setText($text) {
		$this->text = $text;
	}

	public function setHtml($html) {
		$this->html = $html;
	}

	public function addAttachment($file, $filename = '') {
		if (!$filename) {
			$filename = basename($file);
		}

		$this->attachments[] = array(
			'filename' => $filename,
			'file'     => $file
		);
	}

	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 .= 'Date: ' . date("D, d M Y H:i:s O") . $this->newline;
		//$header .= 'From: "' . $this->sender . '" <' . $this->from . '>' . $this->newline;
		//$header .= 'From: ' . $this->sender . '<' . $this->from . '>' . $this->newline;
		$header .= 'From: ' . '=?UTF-8?B?'.base64_encode($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;
		$header .= 'Content-Transfer-Encoding: 8bit' . $this->newline;		
		$header .= $this->newline; 

		if (!$this->html) {
			$message  = '--' . $boundary . $this->newline;
			$message .= '' . $this->newline;
			$message .= '' . $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->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) { 
         if (file_exists($attachment['file'])) {
            $handle = fopen($attachment['file'], 'r');
            $content = fread($handle, filesize($attachment['file']));
      
            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="' . basename($attachment['filename']) . '"' . $this->newline;
            $message .= 'Content-ID: <' . basename($attachment['filename']) . '>' . $this->newline . $this->newline;
            $message .= chunk_split(base64_encode($content));
         }
      }

		$message .= '--' . $boundary . '--' . $this->newline;

		if ($this->protocol == 'mail') {
			ini_set('sendmail_from', $this->from);

			if ($this->parameter) {
				mail($to, '=?UTF-8?B?'.base64_encode($this->subject).'?=', $message, $header, $this->parameter);
			} else {
				mail($to, '=?UTF-8?B?'.base64_encode($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!');
					}
				}

				if ($this->verp) {
					fputs($handle, 'MAIL FROM: <' . $this->from . '>XVERP' . $this->crlf);
				} else {
					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);
			}
		}
	}
}
?>
3 - Contact Form : ( admin/controller/sale/contact.php )

91. Deleted

Code: Select all

$message = str_replace($value, 'cid:' . basename($filename), $message);
110. Before

Code: Select all

$mail->addAttachment($attachment['path'], $attachment['filename']);
110. After & New

Code: Select all

$mail->addAttachment($attachment['filename'], $attachment['filename']);
All Right!

Perfect Worked!

Hotmail, Gmail, Yahoo, AOL, Outlook, Outlook Express, Mozilla Thunderbird, Windows Mail, mail.mywebsite.com/mail

Working with all of them all...

Thanks All,

Newbie

Posts

Joined
Wed Jan 27, 2010 7:17 pm

Post by lucasbg » Mon Oct 03, 2011 12:25 am

@JeffBeck35

Hi

I made the changes suggested by you and the mail body is sent properly now, but the in the mail subject I get the following: "=?UTF-8?B?0J3QvtCy0LjQvdC4INC+0YIg0KHQutCw0LnQv9GA0LjQvdGC?="

Any idea?

Thanks in advance, Luca

PS. OC 1.4.9.5

Newbie

Posts

Joined
Thu Aug 04, 2011 8:27 pm

Post by Solan » Sat Nov 19, 2011 4:30 am

How about last version 1.5.1.3 ?

How to do send emails with images?

Active Member

Posts

Joined
Sat Feb 19, 2011 7:34 pm

Post by JSR » Sat Dec 31, 2011 8:19 pm

OpenCart version 1.5.1.3

I have this same issue with both Thunderbird (6.0.2 and 9.0.1) and Seamonkey (version 2.5). If I view the email on my iPad or through webmail, the images show up fine. If I view the same email in Thunderbird or Seamonkey, they do not.

This is what worked for me:

In mail.php, around line 140: Change 'application/octetstream' to 'application/octet-stream' (note the hyphen!).

Now the images show fine in Thunderbird, Seamonkey, webmail, and iPad. This suggests that there's an issue with Mozilla email clients not recognising "octet-stream" without the hyphen while other email clients do.

I'm no expert so I can't promise it'll be bug-free but I hope it saves someone from spending hours trying things out like it has me.

This doesn't solve the similar problem of the logo image not showing up in the customer's order confirmation email. I think that is a different problem because the hyphen is already present in "octet-stream" and, this time, the image only shows up in webmail - not Seamonkey, Thunderbird, or my iPad.

JSR
Newbie

Posts

Joined
Fri Dec 30, 2011 9:56 pm

Post by clorne » Sun Jan 01, 2012 4:13 am

Images will not embed in emails because of a typo in \system\library\mail.php on about line 140

The MIME content type reads application/octetstream and should be application/octet-stream
(as has already been mentioned)
also the Content-Disposition: attachment; should read basename($attachment['file']) and not basename($attachment['filename']) as filename in this instance is often md5 encoded.

Active Member

Posts

Joined
Fri Dec 23, 2011 6:03 pm

Post by bigbuzz666 » Wed May 23, 2012 12:43 am

JSR, your are a genius...

Thanks, that solves my problem... :D

Newbie

Posts

Joined
Fri Feb 03, 2012 8:13 am

Post by symplink » Sun Aug 26, 2012 3:11 pm

How about vers. 1.5.2.1?
I cannot send images in mail. I write text and add a pic from server, but in gmail arrives only the text I write with no images.
Please help!
Thanks

Newbie

Posts

Joined
Sun Aug 26, 2012 3:06 pm

Post by gteky » Sun Dec 16, 2012 4:08 pm

That fix a few posts above works!

Code: Select all

Images will not embed in emails because of a typo in \system\library\mail.php on about line 140

The MIME content type reads application/octetstream and should be application/octet-stream
(as has already been mentioned)
also the Content-Disposition: attachment; should read basename($attachment['file']) and not basename($attachment['filename']) as filename in this instance is often md5 encoded.
All you need to do is make sure that the image path is not a local one. It needs to be a full path.

Instead of

Code: Select all

/images/file.jpg
it would be

Code: Select all

http://www.domain.com/images/file.jpg
Plus, the line of code to edit in 1.5.3 is not around 140, it's around 150.

:)

Newbie

Posts

Joined
Wed Nov 28, 2012 10:33 am

Post by MrTech » Sun Dec 16, 2012 8:09 pm

This thread was started back in 2009... that's almost 4 years ago! Just goes to show that posting in similar threads is always better than creating a new one which just ends up confusing the issue.

Brownie points for reviving a thread with a solution!

~
Install Extensions OR OpenCart Fast Service! PayPal Accepted
I will professionally install and configure any free or purchased theme, module or extension.

Visit http://www.mrtech.ca if you need an OpenCart webmaster
~


User avatar
Active Member

Posts

Joined
Mon Jan 09, 2012 2:39 pm
Location - Canada, Eh!

Post by xenux » Tue Jul 09, 2013 7:28 pm

This solution above works! Now it shows the images in html newsletter or mail from the admin area. It works in thunderbird! Perfect!

Newbie

Posts

Joined
Fri Aug 31, 2012 7:01 am
Who is online

Users browsing this forum: No registered users and 6 guests