Constructing RFC2822 Message

2005-12-05 Thread Narendra
Hi All,

This is narendra from india doing my engineering.

i need to develop an E-mail client in python,which connects to my MTA
on port 25 and sends email from there.

I was able to do that but my e-mail is ending in bulk when i'm trying
to senf to hotmail/msn.

here im giving the code of my program.
**
import socket,string
import sys
import time
from email import Encoders
import email.Message
import email.Utils
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
# Reading IPConfig File
clientSendingPort = 9000
headuni = '000119-000257-454777-'
headadd  = 555650
i = 0
def read(infile):
try:
flopen = open(infile,'r')
flines = flopen.readlines()
flopen.close()
return flines
except IOError:
print sys.exc_info()

if len(sys.argv) != 3:
print 'Usage: IPAuditMain.py  '
sys.exit()
try:
ipConfigLines = read(sys.argv[1])
emailAddConfigLines = read(sys.argv[2])
print("reading is over")
for line in ipConfigLines:
print("hello")
print line
clIpAddress,injectIPAddress,extnIP,fromadd =
string.split(line,',')
print clIpAddress,injectIPAddress,extnIP
print("how come")

timestamp=time.strftime("[%y%m%d-%H%M%S]",time.localtime(time.time()))
headerUnq = str(headuni) + timestamp
headadd =  headadd + 5;
print headerUnq
for recptEmailAdd in emailAddConfigLines:
print("wt happened")
print recptEmailAdd
soc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print "socket created"
soc.bind((clIpAddress,clientSendingPort))
#print soc.recv(9867)
print "after binding"
soc.connect((injectIPAddress, 25)) # SMTP
print recptEmailAdd
i = i +1
clientSendingPort = clientSendingPort + 1
soc.send("mail from:"+fromadd+"\n")
print soc.recv(9869)
soc.send("rcpt to:"+ recptEmailAdd +"\n")
print soc.recv(9869)
soc.send("data\n")
print soc.recv(9869)
print headerUnq
msg = MIMEBase('multipart','alternative')
msg['X-PVIQ'] = headerUnq
msg['Date']=email.Utils.formatdate(localtime=1)
#msg['Return-Path'] = fromadd
msg['Subject'] = 'Our convo zt'+extnIP
msg['From'] = fromadd
msg['To'] = recptEmailAdd
msg.preamble = 'You will not see this in a MIME-aware mail
reader.\n'
msg.epilogue = ''
outer = MIMEText('\nHai Bob '+
   'What are you doing?
\n\nRegards,',_subtype='plain')
msg.attach(outer)
print("narendra u got here")
soc.send(msg.as_string(0))
print("u have sent the data ")
soc.send("\n.\n")
print("quit")
print  soc.recv(9869)
clientSendingPort = clientSendingPort + 1
soc.close()
except IOError:
print sys.exc_info()
except:
print 'Exception Found. Unable to process'
***

Can anyone please help me out how to fix the problem.

Thanks,
Narendra

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Constructing RFC2822 Message

2005-12-05 Thread Narendra
Thanks jep for the quick response.But when im sending with different
program written in java i was able to send into inbox.

So i thought problem was with the python code only.

Narendra

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Constructing RFC2822 Message

2005-12-19 Thread Narendra
Thanks Steve, No I'm not using windows XP client. I'm using linux
client and no firewall is there

Thanks,
Narendra

-- 
http://mail.python.org/mailman/listinfo/python-list


settings network timeouts in python

2005-12-19 Thread Narendra
Hi All,

I have a problem here. I'm connecting to some pop server.Here i need to
set the network timeouts,since some times my program disconnecting from
net at tht point of time I'm unable to connect to POP server. Can any
one provide the solution for it.

code;

import poplib
m=poplib.POP3('pop.mail.yahoo.com',110)
m.user('XXX')
m.pass_('XXX')
 # here i need to set the network time out when I'm connecting to POP
server. i.e in the line
m=poplib.POP3('pop.mail.yahoo.com')


Any help can be greatly appreciated

Thanks,
Narendra

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: settings network timeouts in python

2005-12-19 Thread Narendra
Thanks Steve

Itz working. Thanks a lot!

-- 
http://mail.python.org/mailman/listinfo/python-list


coverting EST to PST

2005-12-21 Thread Narendra
Hi All,

i got a problem. I need to convert time from EST standard to PST
standard.

Thu, 15 Dec 2005 09:24:19 -0500 to PST

this time i need to convert as PST time

is there any python code which helps me.

your help will be greatly apreciated.

Thanks,
Narendra

-- 
http://mail.python.org/mailman/listinfo/python-list


Timebased Function Scheduler with Pause and UnPause functionality

2011-04-10 Thread Narendra Sisodiya
I wrote some dirty script for Function Scheduling and pausing them !
May some look and point mistakes, I am totally new to python !

https://gist.github.com/911942

-- 
┌─┐
│    Narendra Sisodiya
│    http://narendrasisodiya.com
└─┘
-- 
http://mail.python.org/mailman/listinfo/python-list