Login  Register

Re: ZdcSecureSMTPClient

Posted by Carlo-2 on Oct 22, 2013; 10:32am
URL: https://forum.world.st/Re-ZdcSecureSMTPClient-tp4716396p4716403.html

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