Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #46149 > unrolled thread

Re: This mail never gets delivered. Any ideas why?

Started byCameron Simpson <cs@zip.com.au>
First post2013-05-27 10:28 +1000
Last post2013-05-27 03:01 -0700
Articles 5 — 3 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: This mail never gets delivered. Any ideas why? Cameron Simpson <cs@zip.com.au> - 2013-05-27 10:28 +1000
    Re: This mail never gets delivered. Any ideas why? Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-05-26 22:00 -0700
      Re: This mail never gets delivered. Any ideas why? Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-05-27 02:15 -0700
        Re: This mail never gets delivered. Any ideas why? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-05-27 12:44 +0100
      Re: This mail never gets delivered. Any ideas why? Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-05-27 03:01 -0700

#46149 — Re: This mail never gets delivered. Any ideas why?

FromCameron Simpson <cs@zip.com.au>
Date2013-05-27 10:28 +1000
SubjectRe: This mail never gets delivered. Any ideas why?
Message-ID<mailman.2225.1369614504.3114.python-list@python.org>
On 27May2013 10:22, I wrote:
| | =>  903                         self.stdin.write(input)
[...]
| | self = <subprocess.Popen object>, self.stdin = <_io.BufferedWriter name=5>, self.stdin.write = <built-in method write of _io.BufferedWriter object>, input = 'kdsjfksdjkfjksdjfs\r\n\t'
| | TypeError: 'str' does not support the buffer interface 
| |       args = ("'str' does not support the buffer interface",) 
| |       with_traceback = <built-in method with_traceback of TypeError object>
| 
| This is symptomatic of sys.stdin (well, whatever you're writing to)
| being open in binary mode instead of text mode. And you're passing
| a str. Try passing std.encode().

Sorry, that should be "input.encode()".
-- 
Cameron Simpson <cs@zip.com.au>

PCs are like a submarine, it will work fine till you open Windows. - zollie101

[toc] | [next] | [standalone]


#46163

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-05-26 22:00 -0700
Message-ID<6f870aa1-8a94-4510-a466-ca48e0605d9f@googlegroups.com>
In reply to#46149
else:
		sp = subprocess.Popen(['mail', '-f', FROM, '-s', 'Mail from Guest', 'support@superhost.gr'], sp.stdin=subprocess.PIPE)
		sp.communicate( input.encode(MESSAGE, 'utf-8') )
		status = sp.wait()


this gives me an internal server error Cameron, but i guess iam writing it wrong.

Thsi though doesnt provide an error:

	else:
		sp = subprocess.Popen(['mail', '-f', FROM, '-s', 'Mail from Guest', 'support@superhost.gr'], stdin=subprocess.PIPE)
		sp.communicate( bytes( MESSAGE, 'utf-8' ) )
		status = sp.wait()

but neither gets the mail across.

[toc] | [prev] | [next] | [standalone]


#46182

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-05-27 02:15 -0700
Message-ID<2f789ce5-b493-4ee4-95c4-0e8885978259@googlegroups.com>
In reply to#46163
Please, do you see an error in this?
As i said the 2nd solution doesnt provide an error but also doesn't get the mail send too.

[toc] | [prev] | [next] | [standalone]


#46193

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2013-05-27 12:44 +0100
Message-ID<mailman.2247.1369655065.3114.python-list@python.org>
In reply to#46182
On 27/05/2013 10:15, Νίκος Γκρ33κ wrote:
> Please, do you see an error in this?
> As i said the 2nd solution doesnt provide an error but also doesn't get the mail send too.
>

At least you're improving.  Yesterday you were chasing after two hours, 
it's now up to four hours 15 minutes.  Keep doubling the time like this 
and you'll soon be up to the 24 hours that's considered polite.  As 
previously stated the time can be shortened substantially by getting 
your cheque book out.

-- 
If you're using GoogleCrap™ please read this 
http://wiki.python.org/moin/GoogleGroupsPython.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#46185

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-05-27 03:01 -0700
Message-ID<b78a7f7a-ae58-4697-a683-59e875552341@googlegroups.com>
In reply to#46163
Finally after so many hours of try i have it working:

# =================================================================================================================
# if html form is submitted then send user mail
# =================================================================================================================
if( mailform ):

	if (FROM is None) or (MESSAGE is None) or ('@' not in FROM) or ('Γράψε μου εδώ το σχόλιο σου!' in MESSAGE):
		print( "<h2><font color=red>Συμπλήρωσε σωστά το mail σου και δώσε το σχολιασμό σου!</font></h2>" )
	else:
		maildata = FROM + '\n\n\n' + MESSAGE
		
		sp = subprocess.Popen( ['mail', '-s', 'SuperHost Guest Mail', 'support@superhost.gr'], stdin=subprocess.PIPE )
		sp.communicate( bytes( maildata, 'utf-8' ) )
		status = sp.wait()
		
		if status:
			print( "<h2><font color=red>Δυστυχώς δεν μπόρεσε να αποσταλεί το e-mail :-(" )
		else:
			print( "<h2><font color=lime>Ευχαριστώ πολύ για το ενδιαφέρον! Θα επικοινωνήσω μαζί σου άμεσα :-)</font></h2>" )

	sys.exit(0)
====================

The above worls but as sender it shows my mail and not the mail the user entred into the html box if i try to append a '-f, FROM' like the follwing:

sp = subprocess.Popen( ['mail', '-f, FROM', '-s', 'SuperHost Guest Mail', 'support@superhost.gr'], stdin=subprocess.PIPE )

then the process doenst give me an error, but doesnt also send the mail too.
Is there a way to make the mail seem as it would have come from the 'FROM' field the user entered?

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web