Re: help in xml and python
Diez B. Roggisch wrote: >>can someone please with the code for this. >> >> > >Show us your efforts, and we'd be glad to help you correcting/enhancing >them. > >Or use PayPal and pay one of the guys here - my hourly fee is 50€, and >less than one hour work can't be booked. > >Diez > > I remember a few years ago, I posted something like this to the list, and got flamed 6 ways from Sunday for having the audacity to propose this. 50 Euros/hour is a very good rate by the way.. if more consultants would offer their services this inexpensively, then perhaps it might even be competitive with outsourcing. John -- http://mail.python.org/mailman/listinfo/python-list
Unclear on argument passing to "sendmail'
In "smtplib" module, the "sendmail" method of function is to be passed a host, but it is the Domain name for the SMTP Server as gotten from the "dig" command? IE: dig -tMX would give me the SMTP server. In my code I have: try: print "Sending message to host: %s" % mailHost server=smtplib.SMTP(mailHost) server.sendmail(reply_email,email,body) server.quit() except: print "Uunable to send" Is mailHost like "mail.t-mobile.com" which I get from the MX record for a given domain? But also, is the "email" just the mail account, ie: the username? without the @? I need to be able to query the mail server? Also, I want to be able to handle the "SMTPRecipientsRefused" exception. What is the proper syntax for handling this? Do I do it like this? try: print "Sending message to host: %s" % mailHost server=smtplib.SMTP(mailHost) server.sendmail(reply_email,email,body) server.quit() except SMTPRecipientsRefused: print "Recipient refused" Is that the right syntax? I have severe problems with not enough example code. John I -- http://mail.python.org/mailman/listinfo/python-list
Re: Unclear on argument passing to "sendmail'
Tim Williams wrote: > On 21/08/06, John Draper <[EMAIL PROTECTED]> wrote: > >> In "smtplib" module, the "sendmail" method of function is to be passed > > > host, but it is the Domain name > >> for the SMTP Server as gotten from the "dig" command? IE: dig -tMX >> would give me the SMTP >> server. In my code I have: > > > > >> try: >> print "Sending message to host: %s" % mailHost >> server=smtplib.SMTP(mailHost) >> server.sendmail(reply_email,email,body) >> server.quit() >> except: >> print "Uunable to send" >> >> Is mailHost like "mail.t-mobile.com" which I get from the MX record for >> a given domain? >> But also, is the "email" just the mail account, ie: the username? >> without the @? >> >> I need to be able to query the mail server? Also, I want to be able >> to handle >> the "SMTPRecipientsRefused" exception. What is the proper syntax for >> handling >> this? >> >> Do I do it like this? >> >> try: >> print "Sending message to host: %s" % mailHost >> server=smtplib.SMTP(mailHost) >> server.sendmail(reply_email,email,body) >> server.quit() >> except SMTPRecipientsRefused: >> print "Recipient refused" >> >> Is that the right syntax? I have severe problems with not enough >> example code. >> > > mailHost is the name of the mail server server you are sending the > email to/via, for internet mail this will be a server from the > recipient's domain's mx records (or your ISP server). Ok, that's what I thought, I wasn't sure if I were to put the MAIN host name or the MX host name. > > reply_email is the full email address of the sender, or the email > address you wish to appear as the sender. It does not have to be the > same address as used in the body headers OK > > email is a bad choice for a variable name, try something like > to_email, in your case it should contain the full email address of > the recipeint or a list of recipients. Ok, so If I already have a MX hostname of "mail.myhost.com", then I would put into my "to_email"...@myhost.com for my user name, is that right? And not just without the @myhost.com, right? > The address(es) do not have > to be the same address as used in the body headers OK > > server.sendmail returns a list of failed recipient email addresses if > only some failed, if all the recipients failed you get an exception. Hmmm - the problem I have is if I knowingly put in a bad recipient, and try to send to a unknown user, I get all appearances that the mail went through. I never got any kind of failed recipient (Which for me, is a total bummer), because now I cannot know if the mail was sucessfully sent. Is this normal behaviour for an SMTP server? I know in SOME instances, in the case the SMTP server has to "relay" the mail to another server, I wouldn't get this exception and it would appear the mail went through, but will the "sendmail" method also return the failed recipient's Email address in this case as well? By the way, I'm sending this mail to a "sms" gateway to a cellular provider, so the username is their phone number. But (sigh), these providers don't appear to tell me if I put in a bogus phone number. > > Apologies for the bad formatting below, its untested but should show > you the structure for managing an SMTP msg send. You could tidy it up > without too much effort > > import sys > > for mailHost in MX_records: > try: >print "Sending message to host: %s" % mailHost >server=smtplib.SMTP(mailHost) >failed = server.sendmail(reply_email,email,body) >server.quit() >break > except smtplib.SMTPRecipientsRefused, x : #all recips failed >for recip in x.recipients: >print recip >server.quit() >break > except smtplib.SMTPDataError, x: # an error at the end of the > # message body = MSG Failed > # all recips failed >print x[0], x[1] >server.quit() >break > except smtplib.SMTPSenderRefused, x : # the sender was refused = #MSG > failed > # all recips failed >print x[0], x[1] >server.quit() >break > except: #can't connect so continue to next MX server - don't fail !!! >e_error = str(sys.exc_info()[0]) >print e_error >server.quit() >continue > > for recip in failed: # some failed, some didn't >print recip Hmmm - so THAT's how I use the e
Re: Unclear on argument passing to "sendmail'
I will respond to part of this, although it wasn't directed to me. Tim Williams wrote: > However it really depends on the use-case, relaying through another > server will give you no control over bad addresses, you have to wait > for bounces from the recipient's server, or conversely the ISP server > can give fails 4xx & 5xx for valid addresses. The ISP may only > accept email addressed from their local domains, and you may be > breaking their TOCs or AUP and get blocked. I usually will have no problem with this, and for one reason is because before I add a new ISP to my spam reporting queue, I establish a direct SMTP connection with the ISP's "abuse" email server to confirm the Email is good. I get a lot more then my share of BAD or Bogus Emails listed in some of these whois queries I get. > > On the flip side, some ISPs block outbound port 25 except through > their servers, or transparent proxy port 25, so Direct MX is > unusable. I send all of my spam reports through a commercial T1 link.. I made the bad mistake of sending my spam reports directly from my ComCrap (err - comcast) account, and my service got hosed for a day or so. >> Hmmm - the problem I have is if I knowingly >> put in a bad recipient, and try to send to a >> unknown user, I get all appearances that >> the mail went through. > > > Yes this will happen if you use a relay server. yea - I know :-( > >> Ok, so If I already have a MX hostname >> of "mail.myhost.com", then I would put >> into my "to_email"...@myhost.com for > > > Yes, if you just used username the server wouldn't know which domain > the email was being sent to and therefore how to route it. > >> By the way, I'm sending this mail to a "sms" >> gateway to a cellular provider, so the >> username is their phone number. > > > If you only ever send to this gateway then you might as well try MX > records, you will have more control, but you will need to manage > queueing yourself for temporary failures, or you may decide that if > you get a temporary failure (4xx) to just fire the email off to your > ISP server and let them deal with it. I'm currently exploring a number of different options at this time, including giving the customer an option to go back and re-visit their order page and get an update in the event the message bounces. I'm setting up a special "reply_to" address which I use to collect bounces, and customer's asknowledgement they got the content. Once I get the Ack from the customer, I'll KNOW they got the product. > > >> But >> (sigh), these providers don't appear >> to tell me if I put in a bogus phone number. > > > Unfortunately not all mail servers will fail an invalid address even > if they aren't relaying the email. I haven't really run into a lot of them, but I've had NO experience with SMTP->SMS gateways. > But in this case the SMS > "gateway" is probably relaying to a backend system for the SMSc and > will accept any address with a valid domain part. I already know that Sprint does this, but (sigh) I don't even get the bounces if I re-direct them to a specific Email box DARN - Foiled again. John -- http://mail.python.org/mailman/listinfo/python-list
Re: Python spam?
Hendrik van Rooyen wrote: >"Aahz" <[EMAIL PROTECTED]> wrote: > > > >>Anyone else getting "Python-related" spam? So far, I've seen messages >>"from" Barry Warsaw and Skip Montanaro (although of course header >>analysis proves they didn't send it). >>-- >> >> > >not like that - just the normal crud from people giving me get rich quick tips >on the stock market that is aimed at mobilising my money to follow theirs to >help influence the price of a share... > >- Hendrik > > > > I'm ALWAYS getting python spam but what worries me, is the spammers Know my personal home address, and I NEVER EVER fill out any forms pages with my personal info - I think I'm being harrassed by hackers or something... John -- http://mail.python.org/mailman/listinfo/python-list
Re: Can I use Python instead of Joomla?
walterbyrd wrote: >If I wanted to build a website with forums, news feeds, galleries, >event calander, document managment, etc. I do so in Joomla easily. > >But, I would perfer to use django/python, if that would be at all >practical. > >I suppose I could put python scripts into django, if those scripts >exist. > > > There are at least 3 Python oriented web apps out there. I highly recommend you ditch Joomla as soon as you can. joomla has a lot of security issues, and I've been trying to get my friend off of this POS for the longest time. Her web sites are constantly getting defaced... there are at least 3 Joomla exploits I know of out there. djangoproject.org turbogears.com plone.org Check these out. But get off of Joomla as soon as you can. I admit, Joomla is easy to use I admit, but very easy to vector into a root exploit. John -- http://mail.python.org/mailman/listinfo/python-list
Re: writing captcha image file
[EMAIL PROTECTED] wrote: >I changed the owner of the file to root using chown root newuser.cgi, >but still i m not able to write... > > > Are you running Apache in Chrooted mode? If so, then that might be your problem. John -- http://mail.python.org/mailman/listinfo/python-list