Re: ZdcSecureSMTPClient

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: ZdcSecureSMTPClient

Sven Van Caekenberghe-2
Hi,

On 22 Oct 2013, at 10:46, [hidden email] wrote:

> Hello,
>
> I tried your example for sending code thru Gmail. It works fine with ZdcSecureSMTPClient Pharo 2.0. But when I set the content to an html string. The text shows up as html (<html><body>Dear</body></html>), encoding and all but not html formatted. Ca you tell me what I'm doing wrong. Here is the code:
> mailMessage := MailMessage empty.
> mailMessage setField: 'subject' toString: 'Some subject'.
> mailMessage body: (MIMEDocument  contentType: 'text/html' content:  '<html><body>Dear</body></html>' ).

I just wrote the ZdcSecureSMTPClient subclass, I am not familiar with the finer points of MailMessage. I am guessing that for HTML content you have to work with MIME parts. I am CC-ing the pharo-users list, maybe there are people who already did this who can help you further.

Regards,

Sven
Reply | Threaded
Open this post in threaded view
|

Re: ZdcSecureSMTPClient

Carlo-2
Hi

This code works for me in Pharo 1.3. You may have some success creating a similar MailMessage object but using ZdcSecureSMTPClient as the client.

emailHtml: text to: recipients from: sender subject: subject
        | message |
        message := MailMessage empty.
        message setField: 'from' toString: '[hidden email]'.
        message setField: 'subject' toString: subject.
        message
                addAlternativePart: text contentType: 'text/html'.

        SMTPClient
                deliverMailFrom: message from
                to: (self salesReportReceipients)
                text: message text
                usingServer: self smtpServer

Regards
Carlo

On 22 Oct 2013, at 11:29 AM, Sven Van Caekenberghe <[hidden email]> wrote:

Hi,

On 22 Oct 2013, at 10:46, [hidden email] wrote:

> Hello,
>
> I tried your example for sending code thru Gmail. It works fine with ZdcSecureSMTPClient Pharo 2.0. But when I set the content to an html string. The text shows up as html (<html><body>Dear</body></html>), encoding and all but not html formatted. Ca you tell me what I'm doing wrong. Here is the code:
> mailMessage := MailMessage empty.
> mailMessage setField: 'subject' toString: 'Some subject'.
> mailMessage body: (MIMEDocument  contentType: 'text/html' content:  '<html><body>Dear</body></html>' ).

I just wrote the ZdcSecureSMTPClient subclass, I am not familiar with the finer points of MailMessage. I am guessing that for HTML content you have to work with MIME parts. I am CC-ing the pharo-users list, maybe there are people who already did this who can help you further.

Regards,

Sven


Reply | Threaded
Open this post in threaded view
|

Re: ZdcSecureSMTPClient

Damien Cassou
In reply to this post by Sven Van Caekenberghe-2
On Tue, Oct 22, 2013 at 11:29 AM, Sven Van Caekenberghe <[hidden email]> wrote:
> I just wrote the ZdcSecureSMTPClient subclass, I am not familiar with the finer points of MailMessage. I am guessing that for HTML content you have to work with MIME parts. I am CC-ing the pharo-users list, maybe there are people who already did this who can help you further.

please wrote your comments there:

http://stackoverflow.com/questions/19508544/smalltalk-pharo-zdcsecuresmtpclient-not-showing-html-formatting-in-gmail

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm."
Winston Churchill