Post by maccadon » Sat Sep 25, 2010 4:34 pm

I sent the mail from Opencart thru Google Apps.
In the Gmail client i can read the emails but in the email clients Mozilla Thunderbird and Postbox these emails come in Blank.
I asked the tech depart. of Postbox and they said the Emails sent aren't of the RFC822 standard.
Now instead of using a email client i have to open google mail just for the received order mails.

I'm concerned that my customers receive the same blank email so i would like to know if anybody has a sollution?

See the bugtracker http://www.opencart.com/index.php?route ... &bug_id=70

Tried it on:
Opencart 1.4.8. / 1.4.8b / 1.4.9 / 1.4.9.1
Extensions used
Mymodule (simple HTML)
Homeslider
Global mega options

For sending the mail i use smtp mailer
SSL://smtp.gmail.com
Port 465
Last edited by maccadon on Fri Nov 05, 2010 6:05 pm, edited 2 times in total.

Active Member

Posts

Joined
Thu Aug 05, 2010 9:57 pm

Post by i2Paq » Sat Sep 25, 2010 5:50 pm

Always mention version of your OpenCart!

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by maccadon » Thu Oct 07, 2010 11:42 pm

Does anybody have any idea?

I can read the mail in my google apps gmail account but in my email program (thunderbird/postbox) it appears blank.
This is what i get when i check the source.

Code: Select all

Return-Path: <info@*.nl>
Received: from www.*.nl (da-004.xl-is.net [89.31.97.221])
        by mx.google.com with ESMTPS id z55sm3632026eeh.3.2010.10.07.08.33.58
        (version=SSLv3 cipher=RC4-MD5);
        Thu, 07 Oct 2010 08:33:59 -0700 (PDT)
Message-ID: <4cade867.cf7d0e0a.0148.ffff9ea7@mx.google.com>
Date: Thu, 07 Oct 2010 08:33:59 -0700 (PDT)
To: info@*.nl
Subject: Vraag rene
From: rene <info@*.nl>
Reply-To: rene<rene@*.nl>
Return-Path: rene@*.nl
X-Mailer: PHP/5.2.11
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----=_NextPart_318711e6a403b44adbcfc262011ff55b"
------=_NextPart_318711e6a403b44adbcfc262011ff55b
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

This is a test using the smtp protocol with ssl://smtp.gmail.com on port 465
------=_NextPart_318711e6a403b44adbcfc262011ff55b--

Last edited by i2Paq on Fri Oct 15, 2010 10:28 pm, edited 1 time in total.
Reason: Removed e-mail domains

Active Member

Posts

Joined
Thu Aug 05, 2010 9:57 pm

Post by peter72 » Fri Oct 15, 2010 6:56 pm

I am not sure, but I had a similar problem with OpenCart plus Google Apps and fetchmail.

Code: Select all

reading message user@domain.tld@pop.gmail.com: 1 of 1 (123456789 octets) fetchmail: incorrect header line found while scanning headers not flushed
In my case I started to work well when I added $this->newline at the end of the header.
I just checked it in Mozilla Thunderbird, and also works correctly.

file: system/library/mail.php
line: 102 (version OC 1.4.9.1)

before

Code: Select all

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

Code: Select all

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

Newbie

Posts

Joined
Wed Sep 29, 2010 2:58 pm

Post by maccadon » Fri Oct 15, 2010 10:25 pm

Wow Peter,

I have to try it further but it looks like it works!!
Thank you very much!

Do you have a paypal acount? Then i can buy you a beer.

Active Member

Posts

Joined
Thu Aug 05, 2010 9:57 pm

Post by peter72 » Wed Oct 20, 2010 8:16 pm

Hi maccadon,
maccadon wrote:I have to try it further but it looks like it works!! Thank you very much!
Do you have a paypal acount? Then i can buy you a beer.
No problem.
I have a PayPal account. But no. Thank you for the beer. :-)
I also use the accumulated knowledge on this forum.

Greetings,
Peter

Newbie

Posts

Joined
Wed Sep 29, 2010 2:58 pm

Post by dnoble » Fri Oct 22, 2010 2:31 am

Thx Peter ... that helped

Newbie

Posts

Joined
Fri Oct 22, 2010 2:29 am

Post by speedingorange » Sun May 29, 2011 12:47 am

I have just upgraded to 1.4.9.4 from 1.4.9.3 and am now getting issues with the subject of the email showing as a question mark. Any ideas what the fix is?

It displays fine in gmail / google apps just not in thunderbird

Or if this could be a related issue?
This only happens with order related emails, enquiries etc all come through fine.

Cheers
James

Active Member

Posts

Joined
Tue Feb 23, 2010 7:33 pm

Post by JeffBeck35 » Thu Jun 30, 2011 4:21 pm

Hello All,

I have a problem.

(version OC 1.4.9.4)

My email program mozilla thunderbird and postbox these emails come in "Blank." ( Just text - without image )

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

Waiting for valuable answers.

Thanks.
Jeff

Newbie

Posts

Joined
Wed Jan 27, 2010 7:17 pm

Post by JeffBeck35 » Fri Jul 01, 2011 6:27 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 steppen321 » Fri Jul 29, 2011 2:20 pm

Hi JeffBeck35,


do You had any luck with OC 1.4.9.5 ?

Neither default, nor Your provided mail.php doesn't work properly in 1.4.9.5.

For example:

New customer receives a welcome email to Yahoo mailbox, but an email with order information (on order confirmation) never comes to Yahoo mailbox.

Newbie

Posts

Joined
Mon Dec 13, 2010 11:32 pm

Post by uncleremus » Wed Oct 19, 2011 7:24 am

I was having a similar issue in 1.5.0. What worked for me was to add a second new line after the "Content-Transfer-Encoding:" header.

Line 114 of system/library/mail.php

Orginal: $message .= 'Content-Transfer-Encoding: 8bit' . $this->newline;
Edited: $message .= 'Content-Transfer-Encoding: 8bit' . $this->newline . $this->newline;

Newbie

Posts

Joined
Sat Jul 23, 2011 4:02 am

Post by deejunit » Thu Nov 03, 2011 4:16 am

Strangely enough none of these tips worked for me. My problem was that all the e-mails sent to Yahoo were delivered, but yet did not seem to contain anything - they were just blank.

As I said, tried all of the tips above, in addition to various other (older) threads:
http://forum.opencart.com/viewtopic.php?t=13581
http://forum.opencart.com/viewtopic.php ... rder+blank

My version of opencart is 1.5.1.2.

Finally I managed to solve my problem by changing email protocol from smtp to email. Previously I was using SMTP and gmail smtp to send my e-mails, ssl://smtp.gmail.com:465 as I some how figured this would be safer when it comes to spam filters (?) since my store is located on a shared host. Changing this back to email - and everything works again. Emails in yahoo are delivered correctly, this time with content.

If anyone has a trick to make the emails non-blank when sent to yahoo using gmail smtp, please let me know how you did it :)

New member

Posts

Joined
Sat Jul 21, 2007 5:40 am

Post by webstudent1 » Sun Jan 15, 2012 9:52 am

Expiriences the same problem in the latest versions 1.5.1.3
Change around line 104-> to add the send line here in the mail.php

Code: Select all

		$header .= 'Content-Type: multipart/related; boundary="' . $boundary . '"' . $this->newline;
		$header .= $this->newline;
It worked again.

And gmail is 100% ok

New member

Posts

Joined
Thu Jan 07, 2010 2:24 am

Post by canadian » Mon Feb 13, 2012 7:04 am

JeffBeck35 wrote: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,
This is Brilliant!!! Thanks for posting this. You just made my day MUCH better!

New member

Posts

Joined
Mon Mar 22, 2010 8:44 am

Post by iqubalsingh » Tue Apr 17, 2012 2:16 am

I am getting this error can you help me out...I am using open cart 1.5.2
Notice: Error: RCPT TO not accepted from server! in /home/www/xxxxxxxxxx/system/library/mail.php on line 308

Newbie

Posts

Joined
Sun Mar 04, 2012 2:50 am

Post by waldz » Wed Jun 27, 2012 5:16 am

Did not display body of email in Yahoo and Gmail and on iOS 5, instead only subject is displayed.

Peter72's solution worked for me.

I use version: 1.5.1.3

Thankyou :)

Newbie

Posts

Joined
Mon Aug 08, 2011 3:29 pm

Post by dlew » Mon Jul 08, 2013 12:46 am

Thanks Peter!
Worked with 1.5.1.3

New member

Posts

Joined
Sun Feb 26, 2012 1:56 pm
Who is online

Users browsing this forum: No registered users and 43 guests