[Seaside] Re: [Seaside-dev] Accessing service from a mail .

Gastón Dall' Oglio gaston.dalloglio at gmail.com
Mon Feb 25 20:42:07 UTC 2013


A clarification, in line:

mailMessage setField: 'from' toString: *from*

*from* can be same as *user* or different, depending as your smtp server
configuration.


2013/2/25 Gastón Dall' Oglio <gaston.dalloglio at gmail.com>

> Hello.
>
> Set fullDocument to true to get a HTML Document with a head too, instead
> only the body (but not if it is necessary to send html in an email):
>  WAHtmlCanvas builder fullDocument: true; render: [ :html | ...
>
> I use this code for send email:
>
> sendEmailTo: to subject: subject text: textBody html: htmlBody
> "Send multi-part MIME email message."
>  | server port user password smtpClient mailMessage |
>
> server :=  (self application preferenceAt: #smtpServer).
>  port := (self application preferenceAt: #smtpPort).
> user := (self application preferenceAt: #smtpUsername).
>  password := (self application preferenceAt: #smtpPassword).
>
>
> [ mailMessage := MailMessage empty.
>  mailMessage setField: 'from' toString: from.
> mailMessage setField: 'to' toString: to.
>  mailMessage setField: 'subject' toString: subject.
> mailMessage addAlternativePart: textBody contents contentType:
> 'text/plain'.
>  mailMessage addAlternativePart: htmlBody contents contentType:
> 'text/html'.
>  (smtpClient := ZdcSecureSMTPClient new)
> user: user;
> password: password.
>
> smtpClient openOnHost: (NetNameResolver addressForName: server) port: port.
>
> ^ smtpClient
>  mailFrom: from to: { to } text: mailMessage text;
> quit;
> close;
>  yourself ] on: Exception do: [ :ex | ^ false ].
>
>
> Regards.
>
>
> 2013/2/23 sarath raj <sarathraj99 at gmail.com>
>
>> soln i got , put this in WAEMailMessgage . header is needed
>>
>> headerAt: 'Content-type' put: 'text/html; charset=UTF-8'.
>>
>> Thanks
>>
>>
>> On Sat, Feb 23, 2013 at 2:33 AM, Paul DeBruicker <pdebruic at gmail.com>wrote:
>>
>>> On 02/22/2013 12:26 AM, sarath raj wrote:
>>> > 1) i created a REST Service in seaside sub class of WARestfulFilter  .
>>> > 2) Another Class "testing" derived from WAComponent with a textfield
>>> and
>>> > button .
>>> >
>>> > Action : when i click the button it will send a mail that specified in
>>> > the textfield , and the mail contains a link . that link represents the
>>> > REST service .
>>> > When the user clicks the link , it will start redirect to REST service
>>> .
>>> >
>>> > I done creating mail and all , but i am struck with how i can set a
>>> body
>>> > of a mail with html tags and all .
>>> > Body contain the link to the service
>>> >
>>> >
>>> >
>>> >
>>> > _______________________________________________
>>> > seaside-dev mailing list
>>> > seaside-dev at lists.squeakfoundation.org
>>> > http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>>> >
>>>
>>>
>>> This would probably be better on the seaside users list, just because
>>> more people read it and could respond.  So I cc'd it.
>>>
>>>
>>> Do you want to send an html formatted email?  Is that what you're
>>> asking?  I don't think you can right now, but it shouldn't be too hard
>>> to get it working.
>>>
>>> You can get an html string like this:
>>>
>>> (WARenderCanvas builder render: [ :h | h heading level1; with: 'My
>>> Email'.
>>>         h image url: 'http://www.seaside.st/styles/logo-plain.png' ])
>>>
>>> But I don't know how to put it and a plain version of the body content
>>> in the body plus declaring the content type in the body.  You'd need to
>>> add the Content-Type in the email headers plus a boundary and then in
>>> the body the boundary at the start of the plain & html sections then
>>> also a Content-Type declaration for each section.
>>>
>>>
>>>
>>> _______________________________________________
>>> seaside mailing list
>>> seaside at lists.squeakfoundation.org
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>
>>
>>
>>
>> --
>> Sarath Raj
>>
>> _______________________________________________
>> seaside mailing list
>> seaside at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20130225/bf24f999/attachment-0001.htm


More information about the seaside mailing list