How to send the result file (log file) through email

1,330 views
Skip to first unread message

Sathish Kumar Sathyamoorthy

unread,
Jun 29, 2011, 5:43:28 AM6/29/11
to robotframework-users
Dear All,
I want to send the log file (result file) through email to the
managers i.e., the log file should be read from the harddisk and put
in the Microsoft Outlook, add the receipents and trigger the email.

Is there any function available in Robotframework to accomplish this
task?

Or is there any freeware tool available to do this task?

Janne Härkönen

unread,
Jun 30, 2011, 1:55:23 AM6/30/11
to sooriyan...@gmail.com, robotframework-users
Hello Satish,

On Wed, Jun 29, 2011 at 12:43 PM, Sathish Kumar Sathyamoorthy
<sooriyan...@gmail.com> wrote:
> Dear All,
> I want to send the log file (result file) through email to the
> managers i.e., the log file should be read from the harddisk and put
> in the Microsoft Outlook, add the receipents and trigger the email.
>
> Is there any function available in Robotframework to accomplish this
> task?

No, Robot Framework does not come with support for sending emails.

>
> Or is there any freeware tool available to do this task?

Perhaps you can create a script to do this, using for example Python's
smtplib module [1].

hope this helps,
--J

[1] http://docs.python.org/library/email-examples.html

--
Janne Härkönen | http://reaktor.fi
http://twitter.com/#!/janneharkonen

sathish kumar sathyamoorthy

unread,
Jun 30, 2011, 3:07:24 AM6/30/11
to Janne Härkönen, robotframework-users
Thanks Janne,
I had written the python script to send the email but i'm getting the error.

Python Script:
import os
import sys

# Import SMTPLIB for the email sending function
import smtplib

import mimetypes

# Import the email Module
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
from email import encoders
from email.message import Message
sender = 'sathish.sa...@symphonysv.com'
receivers = ['sooriyan...@gmail.com']

message = """From: From Person <sooriyan...@gmail.com>
To: To Person <sathish.sa...@symphonysv.com>
Subject: SMTP e-mail test

This is a test e-mail message.
"""
smtpObj = smtplib.SMTP('localhost')
smtpObj.sendmail(sender, receivers, message)        
smtpObj.quit()


Error:
Traceback (most recent call last):
  File "C:\Python26\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 325, in RunScript
    exec codeObject in __main__.__dict__
  File "D:\EYC\RobotFramework\Aspects\RSC_TestSuite\Data_Resource_Files\EmailResultFile.py", line 53, in <module>
    smtpObj = smtplib.SMTP('localhost')
  File "C:\Python26\Lib\smtplib.py", line 239, in __init__
    (code, msg) = self.connect(host, port)
  File "C:\Python26\Lib\smtplib.py", line 295, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "C:\Python26\Lib\smtplib.py", line 273, in _get_socket
    return socket.create_connection((port, host), timeout)
  File "C:\Python26\Lib\socket.py", line 514, in create_connection
    raise error, msg
error: [Errno 10061] No connection could be made because the target machine actively refused it

Could you please help me in resolving this issue?

Thanks & regards,
Sathish
--
Thanks & regards,
S.Sathish Kumar

sandeep s

unread,
Jun 30, 2011, 3:38:17 AM6/30/11
to sooriyan...@gmail.com, Janne Härkönen, robotframework-users
Satish,
Which is your smtp server? Are you trying to send something without contacting your smtp sever.
I see that there is sender and receiver ,but which is the medium of transport(server)

I have built the email API using Java ,if in cases needed you can let me know.

Sandeep



--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To post to this group, send email to robotframe...@googlegroups.com.
To unsubscribe from this group, send email to robotframework-u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/robotframework-users?hl=en.

Reply all
Reply to author
Forward
0 new messages