[pLog-svn] r1868 - in plog/branches/plog-1.0.1/class: dao mail
Su Baochen
subaochen at 126.com
Tue Apr 19 01:32:54 GMT 2005
I have found and fix this months ago, but forgotten to commit, sorry!
Just commit another feature: contentType support in mailservice.
在 2005-04-18一的 22:24 +0300,Oscar Renalias写道:
> If anybody else wants to test this feature, please do so. I tested it
> myself with zh_CN and fr_FR which both use utf-8 and it worked great...
> I wonder how come the Chinese-speaking community never requested
> anything like this!
>
> Oscar
>
> On 18 Apr 2005, at 21:57, oscar at devel.plogworld.net wrote:
>
> > Author: oscar
> > Date: 2005-04-18 18:57:16 +0000 (Mon, 18 Apr 2005)
> > New Revision: 1868
> >
> > Modified:
> > plog/branches/plog-1.0.1/class/dao/articlenotifications.class.php
> > plog/branches/plog-1.0.1/class/mail/emailmessage.class.php
> > plog/branches/plog-1.0.1/class/mail/emailservice.class.php
> > Log:
> > this solves issue 414 (http://bugs.plogworld.net/view.php?id=414), by
> > taking the character set from the current locale and passing it to the
> > EmailMessage class (who will eventually pass this information onto the
> > PHPMailer class)
> >
> > Modified:
> > plog/branches/plog-1.0.1/class/dao/articlenotifications.class.php
> > ===================================================================
> > ---
> > plog/branches/plog-1.0.1/class/dao/articlenotifications.class.php
> > 2005-04-18 18:22:18 UTC (rev 1867)
> > +++
> > plog/branches/plog-1.0.1/class/dao/articlenotifications.class.php
> > 2005-04-18 18:57:16 UTC (rev 1868)
> > @@ -75,9 +75,11 @@
> > * mainly will need the email address!)
> > * @param subject Subject of the message that will be sent
> > to the user.
> > * @param body Message that will be sent to the user.
> > + * @param charset the encoding that will be used in the
> > message (it should be based
> > + * on the locale of the blog who is sending this message) It
> > defaults to iso-8859-1
> > * @return Returns true if the user was correctly notified
> > or false otherwise.
> > */
> > - function notifyUser( $notification, $userInfo, $subject,
> > $body )
> > + function notifyUser( $notification, $userInfo, $subject,
> > $body, $charset = 'iso-8859-1' )
> > {
> > //print( "sending notification to
> > ".$userInfo->getEmail()."<br/>");
> > $message = new EmailMessage();
> > @@ -85,6 +87,7 @@
> > $message->addTo( $userInfo->getEmail());
> > $message->setSubject( "pLog Notification system" );
> > $message->setBody( $body );
> > + $message->setCharset( $charset );
> >
> > $service = new EmailService();
> > return $service->sendMessage( $message );
> > @@ -111,12 +114,16 @@
> >
> > $articles = new Articles();
> > $article = $articles->getBlogArticle( $postId, $blogId );
> > +
> > + // get the correct character set
> > + $blogLocale =& $blogInfo->getLocale();
> > + $charset = $blogLocale->getCharset();
> >
> > $users = new Users();
> > foreach( $artNotifs as $notif ) {
> > $userInfo = $users->getUserInfoFromId(
> > $notif->getUserId());
> > $message = $this->renderMessageTemplate( $article,
> > $blogInfo );
> > - $this->notifyUser( $notif, $userInfo, "pLog
> > Notification", $message );
> > + $this->notifyUser( $notif, $userInfo, "pLog
> > Notification", $message, $charset );
> > }
> > }
> >
> >
> > Modified: plog/branches/plog-1.0.1/class/mail/emailmessage.class.php
> > ===================================================================
> > ---
> > plog/branches/plog-1.0.1/class/mail/emailmessage.class.php 2005-04-18
> > 18:22:18 UTC (rev 1867)
> > +++
> > plog/branches/plog-1.0.1/class/mail/emailmessage.class.php 2005-04-18
> > 18:57:16 UTC (rev 1868)
> > @@ -21,6 +21,7 @@
> > var $_mimeType;
> > var $_from;
> > var $_fromName;
> > + var $_charset;
> >
> >
> > /**
> > @@ -33,6 +34,8 @@
> > $this->_toAddrs = Array();
> > $this->_ccAddrs = Array();
> > $this->_bccAddrs = Array();
> > + // use iso-8859-1 as the default character set
> > + $this->_charset = "iso-8859-1";
> >
> > $this->_mimeType = "text/plain";
> > }
> > @@ -195,6 +198,27 @@
> > function getFromName()
> > {
> > return $this->_fromName;
> > - }
> > + }
> > +
> > + /**
> > + * Sets the character set of the message
> > + *
> > + * @param charset The new character set
> > + */
> > + function setCharset( $charset )
> > + {
> > + $this->_charset = $charset;
> > + }
> > +
> > + /**
> > + * Retrieves the character set that was set for this message.
> > Returns
> > + * by default 'iso-8859-1' if no other has been set
> > + *
> > + *Ê@return the character set
> > + */
> > + function getCharset()
> > + {
> > + return( $this->_charset );
> > + }
> > }
> > ?>
> >
> > Modified: plog/branches/plog-1.0.1/class/mail/emailservice.class.php
> > ===================================================================
> > ---
> > plog/branches/plog-1.0.1/class/mail/emailservice.class.php 2005-04-18
> > 18:22:18 UTC (rev 1867)
> > +++
> > plog/branches/plog-1.0.1/class/mail/emailservice.class.php 2005-04-18
> > 18:57:16 UTC (rev 1868)
> > @@ -105,6 +105,9 @@
> > $mail->AddCC( $cc );
> > foreach( $message->getBcc() as $bcc )
> > $mail->AddBCC( $bcc );
> > +
> > + // set the character set of the message
> > + $mail->CharSet = $message->getCharset();
> >
> > //
> > // phpmailer supports
> >
> > _______________________________________________
> > pLog-svn mailing list
> > pLog-svn at devel.plogworld.net
> > http://devel.plogworld.net/mailman/listinfo/plog-svn
> >
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.plogworld.net
> http://devel.plogworld.net/mailman/listinfo/plog-svn
>
More information about the pLog-svn
mailing list