Rack_Jpmail - Version 0.2.2

Version Notes

0.2.2 Fix sender and recipient name broken under double byte env
0.2.1 Modify for 1.5 and 1.6
0.2.0 Add External SMTP Server setting
0.1.6 Add Sender Name Encoding
0.1.5 Separate Text and HTML mail encode.
Add Return-Path
Add Reply-To
0.1.4 Fix system.xml
0.1.3 Fix bcc problem
Add Newsletter/Template.php
0.1.2 Fix Bug.

Download this release

Release Info

Developer Hirokazu Nishi
Extension Rack_Jpmail
Version 0.2.2
Comparing to
See all releases


Code changes from version 0.2.1 to 0.2.2

app/code/community/Rack/Jpmail/Model/Email/Template.php CHANGED
@@ -1,4 +1,4 @@
1
- <?php
2
 
3
  class Rack_Jpmail_Model_Email_Template extends Mage_Core_Model_Email_Template {
4
 
@@ -35,9 +35,13 @@ class Rack_Jpmail_Model_Email_Template extends Mage_Core_Model_Email_Template {
35
 
36
  foreach ($emails as $key => $email) {
37
  if ($this->isPlain()) {
38
- $mail->addTo($email, mb_encode_mimeheader(mb_convert_encoding($names[$key], $textencode, 'utf-8')));
 
 
39
  } else {
40
- $mail->addTo($email, mb_encode_mimeheader(mb_convert_encoding($names[$key], $htmlencode, 'utf-8')));
 
 
41
  }
42
  }
43
 
@@ -48,11 +52,15 @@ class Rack_Jpmail_Model_Email_Template extends Mage_Core_Model_Email_Template {
48
  if ($this->isPlain()) {
49
  $mail->setBodyText(mb_convert_encoding($text, $textencode, 'utf-8'));
50
  $subject = mb_convert_encoding($this->getProcessedTemplateSubject($variables), $textencode, 'utf-8');
51
- $mail->setFrom($this->getSenderEmail(), mb_encode_mimeheader(mb_convert_encoding($this->getSenderName(), $textencode, 'utf-8')));
 
 
52
  } else {
53
  $mail->setBodyHTML(mb_convert_encoding($text, $htmlencode, 'utf-8'));
54
  $subject = mb_convert_encoding($this->getProcessedTemplateSubject($variables), $htmlencode, 'utf-8');
55
- $mail->setFrom($this->getSenderEmail(), mb_encode_mimeheader(mb_convert_encoding($this->getSenderName(), $htmlencode, 'utf-8')));
 
 
56
  }
57
 
58
  $mail->setSubject($subject);
1
+ <?php
2
 
3
  class Rack_Jpmail_Model_Email_Template extends Mage_Core_Model_Email_Template {
4
 
35
 
36
  foreach ($emails as $key => $email) {
37
  if ($this->isPlain()) {
38
+ mb_internal_encoding($textencode);
39
+ $mail->addTo($email, mb_encode_mimeheader($names[$key], $textencode, 'Q'));
40
+ mb_internal_encoding('utf-8');
41
  } else {
42
+ mb_internal_encoding($htmlencode);
43
+ $mail->addTo($email, mb_encode_mimeheader($names[$key], $htmlencode, 'Q'));
44
+ mb_internal_encoding('utf-8');
45
  }
46
  }
47
 
52
  if ($this->isPlain()) {
53
  $mail->setBodyText(mb_convert_encoding($text, $textencode, 'utf-8'));
54
  $subject = mb_convert_encoding($this->getProcessedTemplateSubject($variables), $textencode, 'utf-8');
55
+ mb_internal_encoding($textencode);
56
+ $mail->setFrom($this->getSenderEmail(), mb_encode_mimeheader($this->getSenderName(), $textencode, 'Q'));
57
+ mb_internal_encoding('utf-8');
58
  } else {
59
  $mail->setBodyHTML(mb_convert_encoding($text, $htmlencode, 'utf-8'));
60
  $subject = mb_convert_encoding($this->getProcessedTemplateSubject($variables), $htmlencode, 'utf-8');
61
+ mb_internal_encoding($htmlencode);
62
+ $mail->setFrom($this->getSenderEmail(), mb_encode_mimeheader($this->getSenderName(), $htmlencode, 'Q'));
63
+ mb_internal_encoding('utf-8');
64
  }
65
 
66
  $mail->setSubject($subject);
app/code/community/Rack/Jpmail/Model/Newsletter/Template.php CHANGED
@@ -6,21 +6,8 @@ class Rack_Jpmail_Model_Newsletter_Template extends Mage_Newsletter_Model_Templa
6
  $textencode = Mage::getStoreConfig('jpmail/jpmail/text_charset');
7
  $htmlencode = Mage::getStoreConfig('jpmail/jpmail/html_charset');
8
 
9
- $setReturnPath = Mage::getStoreConfig(Mage_Core_Model_Email_Template::XML_PATH_SENDING_SET_RETURN_PATH);
10
- switch ($setReturnPath) {
11
- case 1:
12
- $returnPathEmail = $this->getSenderEmail();
13
- break;
14
- case 2:
15
- $returnPathEmail = Mage::getStoreConfig(Mage_Core_Model_Email_Template::XML_PATH_SENDING_RETURN_PATH_EMAIL);
16
- break;
17
- default:
18
- $returnPathEmail = null;
19
- break;
20
- }
21
-
22
- if(Mage::getStoreConfig('extsmtp/extsmtp/use_external') == 0 && $returnPathEmail !== null) {
23
- $tr = new Zend_Mail_Transport_Sendmail('-f'.$returnPathEmail);
24
  Zend_Mail::setDefaultTransport($tr);
25
  }
26
 
@@ -55,9 +42,10 @@ class Rack_Jpmail_Model_Newsletter_Template extends Mage_Newsletter_Model_Templa
55
  }
56
  }
57
 
58
- if(Mage::getStoreConfig(Mage_Core_Model_Email_Template::XML_PATH_SENDING_SET_RETURN_PATH)) {
59
- $this->_mail->setReturnPath($returnPathEmail);
60
  }
 
61
  if(Mage::getStoreConfig('jpmail/jpmail/use_reply_to')) {
62
  $this->_mail->setReplyTo(Mage::getStoreConfig('jpmail/jpmail/reply_to'));
63
  }
@@ -103,9 +91,13 @@ class Rack_Jpmail_Model_Newsletter_Template extends Mage_Newsletter_Model_Templa
103
 
104
  $mail = $this->getMail();
105
  if($this->isPlain()) {
106
- $mail->addTo($email, mb_encode_mimeheader(mb_convert_encoding($name, $textencode, 'utf-8')));
 
 
107
  } else {
108
- $mail->addTo($email, mb_encode_mimeheader(mb_convert_encoding($name, $htmlencode, 'utf-8')));
 
 
109
  }
110
 
111
  $text = $this->getProcessedTemplate($variables, true);
@@ -113,12 +105,18 @@ class Rack_Jpmail_Model_Newsletter_Template extends Mage_Newsletter_Model_Templa
113
  if ($this->isPlain()) {
114
  $mail->setBodyText(mb_encode_mimeheader(mb_convert_encoding($text, $textencode, 'utf-8')));
115
  $mail->setSubject(mb_encode_mimeheader(mb_convert_encoding($this->getProcessedTemplateSubject($variables), $textencode, 'utf-8')));
116
- $mail->setFrom($this->getSenderEmail(), mb_encode_mimeheader(mb_convert_encoding($this->getTemplateSenderName(), $textencode, 'utf-8')));
 
 
 
117
  }
118
  else {
119
  $mail->setBodyHTML(mb_encode_mimeheader(mb_convert_encoding($text, $htmlencode, 'utf-8')));
120
  $mail->setSubject(mb_encode_mimeheader(mb_convert_encoding($this->getProcessedTemplateSubject($variables), $htmlencode, 'utf-8')));
121
- $mail->setFrom($this->getSenderEmail(), mb_encode_mimeheader(mb_convert_encoding($this->getTemplateSenderName(), $htmlencode, 'utf-8')));
 
 
 
122
  }
123
 
124
  try {
6
  $textencode = Mage::getStoreConfig('jpmail/jpmail/text_charset');
7
  $htmlencode = Mage::getStoreConfig('jpmail/jpmail/html_charset');
8
 
9
+ if(Mage::getStoreConfig('extsmtp/extsmtp/use_external') == 0 && Mage::getStoreConfig('jpmail/jpmail/use_return_path')) {
10
+ $tr = new Zend_Mail_Transport_Sendmail('-f'.Mage::getStoreConfig('jpmail/jpmail/return_path'));
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  Zend_Mail::setDefaultTransport($tr);
12
  }
13
 
42
  }
43
  }
44
 
45
+ if(Mage::getStoreConfig('jpmail/jpmail/use_return_path')) {
46
+ $this->_mail->setReturnPath(Mage::getStoreConfig('jpmail/jpmail/return_path'));
47
  }
48
+
49
  if(Mage::getStoreConfig('jpmail/jpmail/use_reply_to')) {
50
  $this->_mail->setReplyTo(Mage::getStoreConfig('jpmail/jpmail/reply_to'));
51
  }
91
 
92
  $mail = $this->getMail();
93
  if($this->isPlain()) {
94
+ mb_internal_encoding($textencode);
95
+ $mail->addTo($email, mb_encode_mimeheader($names[$key], $textencode, 'Q'));
96
+ mb_internal_encoding('utf-8');
97
  } else {
98
+ mb_internal_encoding($htmlencode);
99
+ $mail->addTo($email, mb_encode_mimeheader($names[$key], $htmlencode, 'Q'));
100
+ mb_internal_encoding('utf-8');
101
  }
102
 
103
  $text = $this->getProcessedTemplate($variables, true);
105
  if ($this->isPlain()) {
106
  $mail->setBodyText(mb_encode_mimeheader(mb_convert_encoding($text, $textencode, 'utf-8')));
107
  $mail->setSubject(mb_encode_mimeheader(mb_convert_encoding($this->getProcessedTemplateSubject($variables), $textencode, 'utf-8')));
108
+ mb_internal_encoding($textencode);
109
+ $mail->setFrom($this->getSenderEmail(), mb_encode_mimeheader($this->getTemplateSenderName(), $textencode, 'Q'));
110
+ mb_internal_encoding('utf-8');
111
+
112
  }
113
  else {
114
  $mail->setBodyHTML(mb_encode_mimeheader(mb_convert_encoding($text, $htmlencode, 'utf-8')));
115
  $mail->setSubject(mb_encode_mimeheader(mb_convert_encoding($this->getProcessedTemplateSubject($variables), $htmlencode, 'utf-8')));
116
+ mb_internal_encoding($htmlencode);
117
+ $mail->setFrom($this->getSenderEmail(), mb_encode_mimeheader($this->getTemplateSenderName(), $htmlencode, 'Q'));
118
+ mb_internal_encoding('utf-8');
119
+
120
  }
121
 
122
  try {
app/code/community/Rack/Jpmail/Model/Newsletter/php_errors.log DELETED
@@ -1 +0,0 @@
1
- [11-Nov-2011 16:01:15] PHP Parse error: syntax error, unexpected T_STRING in Template.php on line 58
 
app/code/community/Rack/Jpmail/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Rack_Jpmail>
5
- <version>0.1.5</version>
6
  </Rack_Jpmail>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Rack_Jpmail>
5
+ <version>0.2.2</version>
6
  </Rack_Jpmail>
7
  </modules>
8
  <global>
app/locale/ja_JP/Rack_Jpmail.csv DELETED
@@ -1,8 +0,0 @@
1
- "Multibyte Email Settings","マルチバイトメール設定"
2
- "multibyte email setting","マルチバイトメール設定"
3
- "text mail character set","テキストメール文字コード"
4
- "html mail character set","HTMLメール文字コード"
5
- "use return path","Return-Pathを使用する"
6
- "return path","return path"
7
- "use reply to","Reply-toを使用する"
8
- "reply to","reply to"
 
 
 
 
 
 
 
 
package.xml CHANGED
@@ -1,14 +1,15 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Rack_Jpmail</name>
4
- <version>0.2.1</version>
5
  <stability>stable</stability>
6
  <license>Open Software Lisence v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>This module fix email encoding for multibyte environment</summary>
10
  <description>This module fix email encoding for multibyte environment</description>
11
- <notes>0.2.1 Modify for 1.5 and 1.6&#xD;
 
12
  0.2.0 Add External SMTP Server setting&#xD;
13
  0.1.6 Add Sender Name Encoding&#xD;
14
  0.1.5 Separate Text and HTML mail encode.&#xD;
@@ -19,9 +20,9 @@
19
  Add Newsletter/Template.php&#xD;
20
  0.1.2 Fix Bug.</notes>
21
  <authors><author><name>Hirokazu Nishi</name><user>hirokazu_n</user><email>nishi@principle-works.jp</email></author></authors>
22
- <date>2011-11-11</date>
23
- <time>07:19:44</time>
24
- <contents><target name="magelocale"><dir name="ja_JP"><file name="Rack_Jpmail.csv" hash="6323d98df9db69ac9c1da46c9e122525"/></dir><dir name="en_US"><file name="Rack_Jpmail.csv" hash=""/></dir></target><target name="magecommunity"><dir name="Rack"><dir name="Jpmail"><dir name="Helper"><file name="Data.php" hash="184fbc5691c3478047810b827c919dc9"/></dir><dir name="Model"><dir name="Email"><file name="Template.php" hash="d9d1d3e72151a55f6093fc9a189d3945"/></dir><dir name="Newsletter"><file name="Template.php" hash="eea3a54c5d1355d498d9d66d68256c66"/><file name="php_errors.log" hash="5dcf2f9cea03963c4e5f0aad79725e13"/></dir></dir><dir name="etc"><file name="config.xml" hash="dceb5d36b874cbcb403f224fdae4e752"/><file name="system.xml" hash="aed912d9a95c44ecdde8e8ccdfb6c44d"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Rack_Jpmail.xml" hash="15330a682c67f43d2510c0e72991bc53"/></dir></target></contents>
25
  <compatible/>
26
  <dependencies><required><php><min>5.2.0</min><max>5.3.99</max></php><extension><name>mbstring</name><min></min><max></max></extension></required></dependencies>
27
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Rack_Jpmail</name>
4
+ <version>0.2.2</version>
5
  <stability>stable</stability>
6
  <license>Open Software Lisence v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>This module fix email encoding for multibyte environment</summary>
10
  <description>This module fix email encoding for multibyte environment</description>
11
+ <notes>0.2.2 Fix sender and recipient name broken under double byte env&#xD;
12
+ 0.2.1 Modify for 1.5 and 1.6&#xD;
13
  0.2.0 Add External SMTP Server setting&#xD;
14
  0.1.6 Add Sender Name Encoding&#xD;
15
  0.1.5 Separate Text and HTML mail encode.&#xD;
20
  Add Newsletter/Template.php&#xD;
21
  0.1.2 Fix Bug.</notes>
22
  <authors><author><name>Hirokazu Nishi</name><user>hirokazu_n</user><email>nishi@principle-works.jp</email></author></authors>
23
+ <date>2011-12-19</date>
24
+ <time>14:25:31</time>
25
+ <contents><target name="magelocale"><dir name="ja_JP"><file name="Rack_Jpmail.csv" hash=""/></dir><dir name="en_US"><file name="Rack_Jpmail.csv" hash=""/></dir></target><target name="magecommunity"><dir name="Rack"><dir name="Jpmail"><dir name="Helper"><file name="Data.php" hash="184fbc5691c3478047810b827c919dc9"/></dir><dir name="Model"><dir name="Email"><file name="Template.php" hash="a4c624e7a97a8ab221bbb6cad6fab6c7"/></dir><dir name="Newsletter"><file name="Template.php" hash="7d1a5f21aab82545b90974f38f4e96f4"/></dir></dir><dir name="etc"><file name="config.xml" hash="60fe9f4bd8df529eed22e6337dd9c972"/><file name="system.xml" hash="aed912d9a95c44ecdde8e8ccdfb6c44d"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Rack_Jpmail.xml" hash="15330a682c67f43d2510c0e72991bc53"/></dir></target></contents>
26
  <compatible/>
27
  <dependencies><required><php><min>5.2.0</min><max>5.3.99</max></php><extension><name>mbstring</name><min></min><max></max></extension></required></dependencies>
28
  </package>