Sending email with Pharo

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

Sending email with Pharo

Hilaire Fernandes
Dear all,

A DrGeo user asked me if it will be possible to share DrGeo sketch by
Email. I guess he means, sending an email with an attached DrGeo file.

My question is:
- can we send email with Pharo?
- if yes, can we attach file to such email?

Any pointer, if any, appreciated

Thanks

Hilaire

PS: if any of you have any idea how to share a file between different
DrGeo instances running in different host, I will greatly appreciate
your ideas/advices.


Reply | Threaded
Open this post in threaded view
|

Re: Sending email with Pharo

Marcus Denker-4

On Sep 15, 2012, at 8:57 AM, Hilaire Fernandes <[hidden email]> wrote:

> Dear all,
>
> A DrGeo user asked me if it will be possible to share DrGeo sketch by
> Email. I guess he means, sending an email with an attached DrGeo file.
>
> My question is:
> - can we send email with Pharo?
> - if yes, can we attach file to such email?
>
> Any pointer, if any, appreciated
>

I am using http://postmarkapp.com/

Very easy to set up, and they make sure that the mail does not get
tagged as spam and so on.

Thre is a ready to use library for Pharo:

        http://articles.tulipemoutarde.be/send-email-from-pharo-with-postmark

Works great! We used it for the ESUG registration server this year.

        Marcus

--
Marcus Denker -- http://marcusdenker.de


Reply | Threaded
Open this post in threaded view
|

Re: Sending email with Pharo

Hilaire Fernandes
Thanks. It does not handle attachment right now as described by
François. Is it a limitation of the Pharo Postmark library or the Pharo
SMTP library?

Thanks

Hilaire

Le 15/09/2012 09:42, Marcus Denker a écrit :

> I am using http://postmarkapp.com/
>
> Very easy to set up, and they make sure that the mail does not get
> tagged as spam and so on.




Reply | Threaded
Open this post in threaded view
|

Re: Sending email with Pharo

Marcus Denker-4

On Sep 15, 2012, at 10:11 AM, Hilaire Fernandes <[hidden email]> wrote:

> Thanks. It does not handle attachment right now as described by
> François.

I thought is does? The last line is "edit: you can now attach files to your emails !"


> Is it a limitation of the Pharo Postmark library or the Pharo
> SMTP library?
>

Postmark does not use SMTP. So the lib should be very easy to extend.

> Thanks
>
> Hilaire
>
> Le 15/09/2012 09:42, Marcus Denker a écrit :
>
>> I am using http://postmarkapp.com/
>>
>> Very easy to set up, and they make sure that the mail does not get
>> tagged as spam and so on.
>
>
>
>

--
Marcus Denker -- http://marcusdenker.de


Reply | Threaded
Open this post in threaded view
|

Re: Sending email with Pharo

Hilaire Fernandes
Le 15/09/2012 10:14, Marcus Denker a écrit :

> I thought is does? The last line is "edit: you can now attach files to your emails !"


Oh, my fault, Fantastic.
Appending the info in the drgeo bug ticket.
https://bugs.launchpad.net/drgeo/+bug/1051168

Thanks

Hilaire




Reply | Threaded
Open this post in threaded view
|

Re: Sending email with Pharo

Hilaire Fernandes
In reply to this post by Marcus Denker-4
Le 15/09/2012 09:42, Marcus Denker a écrit :

> I am using http://postmarkapp.com/
>
> Very easy to set up, and they make sure that the mail does not get
> tagged as spam and so on.
>
> Thre is a ready to use library for Pharo:
>
> http://articles.tulipemoutarde.be/send-email-from-pharo-with-postmark
>
> Works great! We used it for the ESUG registration server this year.
>
> Marcus



Reply | Threaded
Open this post in threaded view
|

Re: Sending email with Pharo

Stephan Eggermont-3
In reply to this post by Hilaire Fernandes
Hi Hilaire,

There was a post from Scott Sproule on using Amazon SES with zinc and stunnel.
Sven, you remember? From the response it was not clear to me if he managed
to get everything working, and the need for stunnel might not be there with the
current SSL support. SES is about 10% of the cost of postmaster.

Attaching to mail is a well-known process. There are no problems there.

Stephan



Reply | Threaded
Open this post in threaded view
|

Re: Sending email with Pharo

Willem van den Ende
I've used SMTP with a mail server (Exim) installed on the same server for a small registration site. Haven't needed attachments. We did have one or two mails that weren't sent (don't know the exact cause, hard to reproduce).

on the one hand, the SMTP is pretty low level, on the other hand, there is no magic, no external service to subscribe to or custom protocols.

Attachment would involve creating a MIME-encoded piece of text, couldn't find one quickly by search engine.

sample code, taken from app:
sendText: text
"Only works with locally installed SMTP server"
|smtp|
smtp := SMTPClient openOnHostNamed: 'your.host.com'.

[ smtp initiateSession.
smtp mailFrom: '[hidden email]' to: #('[hidden email]') text:
'From: '[hidden email]'l
Subject: your subject

', text.
smtp quit.
] ensure: [smtp close]

Note that you have to close the SMTP connection (it opens a socket to your mailserver that needs to be closed).

Hope this helps,

Willem

On 15 September 2012 19:54, Stephan Eggermont <[hidden email]> wrote:
Hi Hilaire,

There was a post from Scott Sproule on using Amazon SES with zinc and stunnel.
Sven, you remember? From the response it was not clear to me if he managed
to get everything working, and the need for stunnel might not be there with the
current SSL support. SES is about 10% of the cost of postmaster.

Attaching to mail is a well-known process. There are no problems there.

Stephan




Reply | Threaded
Open this post in threaded view
|

Re: Sending email with Pharo

Gastón Dall' Oglio
In reply to this post by Hilaire Fernandes
Hello Hilaire.

Zodiac? I used zodiac to send email from contact forms in web sites made with Seaside, and works fine. Although sometimes they go to spam :/

But, instead to use ZdcSecureSMTPClient class>>sendUsingGMailAccount:password:to:message: , I created a slightly modified version of that method, due to the smtp server I use the "from" field in mail message is different to "user" in smtp client. E.g. for "from" [hidden email] the smtp "user" look like user1.mailserver.
This is the method:

*************************

sendServer: server port: port user: user password: password from: from to: to subject: subject body: body
| smtpClient mailMessage |

mailMessage := MailMessage empty.
mailMessage setField: 'from' toString: from.
mailMessage setField: 'to' toString: to.
mailMessage setField: 'subject' toString: subject.
mailMessage body: (MIMEDocument contentType: 'text/plain' content: body).

(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

********************************

Regards

2012/9/15 Hilaire Fernandes <[hidden email]>
Dear all,

A DrGeo user asked me if it will be possible to share DrGeo sketch by
Email. I guess he means, sending an email with an attached DrGeo file.

My question is:
- can we send email with Pharo?
- if yes, can we attach file to such email?

Any pointer, if any, appreciated

Thanks

Hilaire

PS: if any of you have any idea how to share a file between different
DrGeo instances running in different host, I will greatly appreciate
your ideas/advices.