[squeak-dev] Problem with SMTPClient

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

[squeak-dev] Problem with SMTPClient

Mariano Martinez Peck
Hi: I am trying to send an email from Squeak. I have ubuntu and postfix smtp server running in my local machine. I know postfix is running OK. I could do successfully the following test from a linux console:

220 Servidor ESMTP
HELO localhost
250 Hello, please meet you
MAIL FROM: [hidden email]
250 Ok
RCPT TO: [hidden email]
250 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
Subject: Campo de asunto
From: [hidden email]
To: [hidden email]
Hola,
Esto es una prueba3.
Adiós.
.
quit


However, when I try to do SMTPClient I do something like this:

| message sender recipients |
message := 'From: DestinoMochila <[hidden email]>
To: You <[hidden email]>
Subject: Simple Mail from Squeak

This is a test mail'.
sender := '[hidden email]'.
recipients := #('[hidden email]').
SMTPClient
    deliverMailFrom: sender
    to: recipients
    text: message
    usingServer: '127.0.0.1'


I have no errors, but the email is never send :(

This is the first time I try to use SMTPClient so perhaps I am doing something wrong.

Any idea?

Thanks in advance,

Mariano



Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Problem with SMTPClient

Chun, Sungjin
Hi,

I hope this can help you. Can you let us know the log of the SMTP server
in 127.0.0.1(that's what you tested with linux console, right?) ?

Following code is one of my method for sending email messages, and I also cannot
find any meaningful differences between your code and mine.

sendMail
        | client msg m sub mm recvs |
        client _ SMTPClient openOnHostNamed: smtpServer.
        userID isEmptyOrNil
                ifFalse: [ client user: userID.
                                 password isEmptyOrNil
                                        ifTrue: [ client password: '' ]
                                        ifFalse: [ client password: password ]].
        m _ MimeConverter forEncoding: 'base64'.
        "sub _ (m mimeEncode: (subject convertToWithConverter: (UTF8TextConverter new)) readStream)
                contents."
        sub _ (m mimeEncode: subject readStream) contents.
        sub _ sub copyReplaceAll: String cr with: ''.
        "mm _ (m mimeEncode: (messageBody convertToWithConverter: (UTF8TextConverter new))
                readStream) contents."
        mm _ (m mimeEncode: messageBody readStream) contents.
        recvs _ (receivers inject: '' into: [ :s :e | s size = 0 ifTrue: [ s _ s, e ] ifFalse: [ s _ s, ', ', e ]]).
        msg _
                'MIME-Version: 1.0', String cr,
                'Content-Type: text/html; charset=UTF-8', String cr,
                'Content-Transfer-Encoding: base64', String cr,
                'X-Priority: 3', String cr,
                'X-Mailer: NXT', String cr,
                'Sender: ', replyTo, String cr,
                'Subject: ', '=?UTF-8?B?', sub, '?=', String cr,
                'To: ', recvs, String cr, String cr,
                mm.
        [
                client login.
                client
                        mailFrom: replyTo
                        to: receivers asArray
                        "text: (msg convertToWithConverter: (UTF8TextConverter new))."
                        text: msg.
         client quit ] ensure: [ client close ].

----- Original Message -----
   From: Mariano Martinez Peck <[hidden email]>
   To: The general-purpose Squeak developers list <[hidden email]>
   Sent: 09-05-06 22:26:37
   Subject: [squeak-dev] Problem with SMTPClient

  Hi: I am trying to send an email from Squeak. I have ubuntu and postfix smtp server running in my local machine. I know postfix is running OK. I could do successfully the following test from a linux console:<br><br>220 Servidor ESMTP<br>

HELO localhost<br>250 Hello, please meet you<br>MAIL FROM: <a href="mailto:[hidden email]" target="_blank">[hidden email]</a><br>250 Ok<br>RCPT TO: <a href="mailto:[hidden email]" target="_blank">[hidden email]</a><br>


250 Ok<br>DATA<br>354 End data with &lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt;<br>Subject: Campo de asunto<br>From: <a href="mailto:[hidden email]" target="_blank">[hidden email]</a><br>To: <a href="mailto:[hidden email]" target="_blank">[hidden email]</a><br>


Hola,<br>Esto es una prueba3.<br>Adi?.<br>.<br>quit<br><br><br>However, when I try to do SMTPClient I do something like this:<br><br>| message sender recipients |<br>message := &#39;From: DestinoMochila &lt;<a href="mailto:[hidden email]" target="_blank">[hidden email]</a>&gt;<br>
To: You &lt;<a href="mailto:[hidden email]" target="_blank">[hidden email]</a>&gt;<br>
Subject: Simple Mail from Squeak<br><br>This is a test mail&#39;.<br>sender := &#39;<a href="mailto:[hidden email]" target="_blank">[hidden email]</a>&#39;.<br>recipients := #(&#39;<a href="mailto:[hidden email]" target="_blank">[hidden email]</a>&#39;).<br>

SMTPClient<br>??? deliverMailFrom: sender<br>??? to: recipients<br>??? text: message<br>??? usingServer: &#39;127.0.0.1&#39;<br><br><br>I have no errors, but the email is never send :(<br><br>This is the first time I try to use SMTPClient so perhaps I am doing something wrong.<br>
<br>Any idea?<br><br>Thanks in advance,<br><br>Mariano<br><br>


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Problem with SMTPClient

Chun, Sungjin
In reply to this post by Mariano Martinez Peck
Hi,

I hope this can help you. Can you let us know the log of the SMTP server
in 127.0.0.1(that's what you tested with linux console, right?) ?

Following code is one of my method for sending email messages, and I also cannot
find any meaningful differences between your code and mine.

sendMail
        | client msg m sub mm recvs |
        client _ SMTPClient openOnHostNamed: smtpServer.
        userID isEmptyOrNil
                ifFalse: [ client user: userID.
                                 password isEmptyOrNil
                                        ifTrue: [ client password: '' ]
                                        ifFalse: [ client password: password ]].
        m _ MimeConverter forEncoding: 'base64'.
        "sub _ (m mimeEncode: (subject convertToWithConverter: (UTF8TextConverter new)) readStream)
                contents."
        sub _ (m mimeEncode: subject readStream) contents.
        sub _ sub copyReplaceAll: String cr with: ''.
        "mm _ (m mimeEncode: (messageBody convertToWithConverter: (UTF8TextConverter new))
                readStream) contents."
        mm _ (m mimeEncode: messageBody readStream) contents.
        recvs _ (receivers inject: '' into: [ :s :e | s size = 0 ifTrue: [ s _ s, e ] ifFalse: [ s _ s, ', ', e ]]).
        msg _
                'MIME-Version: 1.0', String cr,
                'Content-Type: text/html; charset=UTF-8', String cr,
                'Content-Transfer-Encoding: base64', String cr,
                'X-Priority: 3', String cr,
                'X-Mailer: NXT', String cr,
                'Sender: ', replyTo, String cr,
                'Subject: ', '=?UTF-8?B?', sub, '?=', String cr,
                'To: ', recvs, String cr, String cr,
                mm.
        [
                client login.
                client
                        mailFrom: replyTo
                        to: receivers asArray
                        "text: (msg convertToWithConverter: (UTF8TextConverter new))."
                        text: msg.
         client quit ] ensure: [ client close ].

----- Original Message -----
   From: Mariano Martinez Peck <[hidden email]>
   To: The general-purpose Squeak developers list <[hidden email]>
   Sent: 09-05-06 22:26:37
   Subject: [squeak-dev] Problem with SMTPClient

  Hi: I am trying to send an email from Squeak. I have ubuntu and postfix smtp server running in my local machine. I know postfix is running OK. I could do successfully the following test from a linux console:<br><br>220 Servidor ESMTP<br>

HELO localhost<br>250 Hello, please meet you<br>MAIL FROM: <a href="mailto:[hidden email]" target="_blank">[hidden email]</a><br>250 Ok<br>RCPT TO: <a href="mailto:[hidden email]" target="_blank">[hidden email]</a><br>


250 Ok<br>DATA<br>354 End data with &lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt;<br>Subject: Campo de asunto<br>From: <a href="mailto:[hidden email]" target="_blank">[hidden email]</a><br>To: <a href="mailto:[hidden email]" target="_blank">[hidden email]</a><br>


Hola,<br>Esto es una prueba3.<br>Adi?.<br>.<br>quit<br><br><br>However, when I try to do SMTPClient I do something like this:<br><br>| message sender recipients |<br>message := &#39;From: DestinoMochila &lt;<a href="mailto:[hidden email]" target="_blank">[hidden email]</a>&gt;<br>
To: You &lt;<a href="mailto:[hidden email]" target="_blank">[hidden email]</a>&gt;<br>
Subject: Simple Mail from Squeak<br><br>This is a test mail&#39;.<br>sender := &#39;<a href="mailto:[hidden email]" target="_blank">[hidden email]</a>&#39;.<br>recipients := #(&#39;<a href="mailto:[hidden email]" target="_blank">[hidden email]</a>&#39;).<br>

SMTPClient<br>??? deliverMailFrom: sender<br>??? to: recipients<br>??? text: message<br>??? usingServer: &#39;127.0.0.1&#39;<br><br><br>I have no errors, but the email is never send :(<br><br>This is the first time I try to use SMTPClient so perhaps I am doing something wrong.<br>
<br>Any idea?<br><br>Thanks in advance,<br><br>Mariano<br><br>


Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: Problem with SMTPClient

Mariano Martinez Peck
In reply to this post by Mariano Martinez Peck
Ok, it was a problem with gmail, as I could figure out from logs:


May 10 18:07:52 mariano-ubuntu postfix/smtp[20948]: 0BD8167ECD: to=<destinomochila@gmail.com>, relay=gmail-smtp-in.l.google.com[72.14.247.27]:25, delay=33, delays=0.02/0/1.8/31, dsn=5.7.1, status=bounced (host gmail-smtp-in.l.google.com[72.14.247.27] said: 550-5.7.1 [190.174.233.43] The IP you're using to send mail is not authorized to 550-5.7.1 send email directly to our servers. Please use the SMTP relay at your 550-5.7.1 service provider instead. Learn more at            http://mail.google 550 5.7.1 .com/support/bin/answer.py?answer=10336 5si5675126agc.55 (in reply to end of DATA command))
May 10 18:07:52 mariano-ubuntu postfix/qmgr[20945]: 0BD8167ECD: removed



On Wed, May 6, 2009 at 10:26 AM, Mariano Martinez Peck <[hidden email]> wrote:
Hi: I am trying to send an email from Squeak. I have ubuntu and postfix smtp server running in my local machine. I know postfix is running OK. I could do successfully the following test from a linux console:

220 Servidor ESMTP
HELO localhost
250 Hello, please meet you
MAIL FROM: [hidden email]
250 Ok
RCPT TO: [hidden email]
250 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
Subject: Campo de asunto
From: [hidden email]
To: [hidden email]
Hola,
Esto es una prueba3.
Adiós.
.
quit


However, when I try to do SMTPClient I do something like this:

| message sender recipients |
message := 'From: DestinoMochila <[hidden email]>
To: You <[hidden email]>
Subject: Simple Mail from Squeak

This is a test mail'.
sender := '[hidden email]'.
recipients := #('[hidden email]').
SMTPClient
    deliverMailFrom: sender
    to: recipients
    text: message
    usingServer: '127.0.0.1'


I have no errors, but the email is never send :(

This is the first time I try to use SMTPClient so perhaps I am doing something wrong.

Any idea?

Thanks in advance,

Mariano