Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.networking > #2266
| From | Ferrous Cranus <nikos@superhost.gr> |
|---|---|
| Newsgroups | comp.os.linux.networking |
| Subject | Re: Trying to utilize mailx to send mail via apython script |
| Date | 2013-09-08 09:54 +0300 |
| Organization | A noiseless patient Spider |
| Message-ID | <l0h6ub$3mb$1@dont-email.me> (permalink) |
| References | <l0aaf9$2fe$1@dont-email.me> <l0bvs4$3sr$1@dont-email.me> <l0gccn$r86$1@dont-email.me> |
Στις 8/9/2013 2:20 πμ, ο/η Todd έγραψε:
> On 09/06/2013 12:37 AM, Νίκος - Support wrote:> Στις 6/9/2013 10:20 πμ,
> ο/η Todd έγραψε:
> >> On 09/05/2013 09:11 AM, Ferrous Cranus wrote:
> >>>
> >>>
> >>> i as root just installed
> >>>
> >>> sendmail and mailx. i have edited the ~/.mailrc to use:
> >>>
> >>>
> >>> nikos@superhost.gr [~/www/cgi-bin]# cat ~/.mailrc
> >>> account gmail {
> >>> set smtp-use-starttls
> >>> set smtp=smtp://smtp.gmail.com:587
> >>> set smtp-auth=login
> >>> set smtp-auth-user=may)gmail
> >>> set smtp-auth-password=my_gmail_pass_not_stupid_enough_to_wite
> _it_again
> >>> }e
> >>>
> >>>
> >>>
> >>> And now i'm trying to:
> >>>
> >>>
> >>> cmd = "echo %s | mailx -A gmail -r %s -s %s %s" % (MESSAGE, FROM,
> >>> SUBJECT, TO)
> >>> p=subprocess.Popen( cmd, shell=True, stdout=subprocess.PIPE )
> >>> output, errors = p.communicate()
> >>> print( errors, output )
> >>>
> >>>
> >>> Any ideas please why this fails to work?
> >>> while i remove the '-A gmail' string in the cmd line then i can send
> >>> fast mail but only to mail containing the @superhost.gr trail.
> >>>
> >>> i need to be eble to send to external mails to.
> >>
> >> Hi Ferrous,
> >>
> >> Your .mailrc syntax is too weird. I place all my parameters
> >> inside my script.
> >>
> >> gMail is a pain in the ... to use with mailx. Here is a test
> >> script I wrote that should help you. Change the "Your_email_address",
> >> "Your_other_email_address", and "Your_email_password"
> >> appropriately
> >>
> >> Create a separate mailcert directory, copy your mailcerts
> >> $ ls
> >> cert7.db cert8.db key3.db secmod.db
> >> from your Firefox directory to it, and point your "nss-config-dir"
> >> at it.
> >>
> >> Note that some of my lines scrolled when I pasted.
> >>
> >> Good luck,
> >> -T
> >>
> >>
> >> $ cat MailxTest.gmail
> >> #!/bin/bash
> >>
> >> echo "mailx test" | mailx -v -s `dnsdomainname`" gmail smtp test
> >> subject" \
> >> -S smtp-use-starttls \
> >> -S ssl-verify=ignore \
> >> -S smtp-auth=login \
> >> -S smtp=smtp://smtp.gmail.com:587 \
> >> -S from=Your_email_address@gmail.com \
> >> -S smtp-auth-user=Your_email_address@gmail.com \
> >> -S smtp-auth-password="Your_email_password" \
> >> -S nss-config-dir=/home/linuxutil/mailcerts/ \
> >> Your_other_email_address@gmail.com
> >
> > Hello Todd,
> >
> > Do i download them from Google? What
> > their use?
> > i don't user FF i use Chrome instead.
> >
>
> > Please elaborate.
>
> Certainly! gmail and zmail (zoho.com) are both huge
> pains in the --- to get working from a script.
>
> Hi Νίκος,
>
> The batch script is how to send "From:" a gmail
> account with a batch script using mailx. The
> "To:" can be anyone.
>
> I also have a script to do the same thing from a
> zoho account (zmail), if anyone wants it.
>
> First let me write the comments in my batch file a little better.
> Remember, this BASH script is a only for sending from a script
> through gMail.
>
> -------- cat MailxTest.gmail -----------
> #!/bin/bash
> #
> echo "mailx test" | mailx -v -s `dnsdomainname`" gmail smtp test subject" \
> -S smtp-use-starttls \
> -S ssl-verify=ignore \
> -S smtp-auth=login \
> -S smtp=smtp://smtp.gmail.com:587 \
> -S from=From_email_address@gmail.com \
> -S smtp-auth-user=From_email_address@gmail.com \
> -S smtp-auth-password="From_email_password" \
> -S nss-config-dir=/home/linuxutil/mailcerts/ \
> To_email_address@gmail.com
>
> ---------------------------------------------------
>
> > i want to try your example but i don't know where i'm
> > supposed to find the cert* and key* files.
>
> You will find them in your gMail profile. Your profile
> is in your home directory under
> $HOME/.mozilla/firefox/your_profiles_cypher_name
>
> 1) install firefox
>
> 2) start firefox and let it automatically create its first
> profile
>
> 3) open a terminal/xterm in your home directory
>
> 4) search for the certificates with
> find $HOME/.mozilla/firefox -iname \*cert\*.db
> remember to copy all the *.db's over from your profile
> to a separate directory. Mine are:
>
> cert7.db cert8.db key3.db secmod.db
>
> Firefox needs these certificates to do the "s" in https
>
> 5) modify "nss-config-dir=/home/linuxutil/mailcerts/" in
> the above script to match the directory you copied the
> certificates to
>
>
> > What are the mailcerts anyway?
>
> gMail uses SSL (secure socket layer or the "s" in https) and
> need these certificates to authenticate. So does zmail, but
> uses a different sign in method.
>
> > The code above is supposed to be use in a file called
> > 'MailxTest.gmail'
>
> This is a Bash script. The first line in the script "#!/bin/bash"
> tells you this.
>
> > not from within a python script i have called 'mail.py' ?
>
> No. Not to a Python script. Get it working in Bash first,
> them translate it to Python. YOUR PYTHON SUBROUTINE WILL NEED
> THESE CERTIFICATES TOO! If you can get it working in BASH,
> you are 90% of the way there.
>
> > Also what is the other thing at the end
> > you_other_email_address@gmail.com
>
> My bad. I should have said it was the gMail "To"
> address, which can be anyone.
>
> Good luck, I am dying to know if this helped you or
> anyone else. I am usually the one asking the questions.
>
> -T
>
Hello Todd!
Let me tell you what i did:
i have:
rm ~./mailrc
nikos@superhost.gr [~]# cat MailXTest.gmail
#!/bin/bash
#
echo "mailx test" | mailx -v -s `dnsdomainname`" gmail smtp test subject" \
-S smtp-use-starttls \
-S ssl-verify=ignore \
-S smtp-auth=login \
-S smtp=smtp://smtp.gmail.com:587 \
-S from=Your_email_address@gmail.com \
-S smtp-auth-user=my@gmail.com \
-S smtp-auth-password="my_gmail_pass" \
-S nss-config-dir=/home/nikos/certs/ \
nikos@ath.forthnet.gr
chmod u+x MailXTest.gmail
and finally when i try to run it:
nikos@superhost.gr [~]# MailXTest.gmail
-bash: MailXTest.gmail: command not found
What iam doing?
Apart from that i want to avoid using GMail's service becazue it adds up
a Sender: header sayign that the mail originating from my gmail accoutn
while i want to use the FROM field that the visitor used in my html web
form to fill in his email
Also it would be nice if the hostname would appear too.
Do we need to setup our own mail servr to achieve this?
--
Webhost <http://superhost.gr>
Back to comp.os.linux.networking | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Trying to utilize mailx to send mail via apython script Ferrous Cranus <nikos@superhost.gr> - 2013-09-05 19:11 +0300
Re: Trying to utilize mailx to send mail via apython script Jorgen Grahn <grahn+nntp@snipabacken.se> - 2013-09-05 18:13 +0000
Re: Trying to utilize mailx to send mail via apython script Ferrous Cranus <nikos@superhost.gr> - 2013-09-06 09:19 +0300
Re: Trying to utilize mailx to send mail via apython script Jorgen Grahn <grahn+nntp@snipabacken.se> - 2013-09-06 08:50 +0000
Re: Trying to utilize mailx to send mail via apython script Ferrous Cranus <nikos@superhost.gr> - 2013-09-06 12:06 +0300
Re: Trying to utilize mailx to send mail via apython script "Jonathan N. Little" <lws4art@gmail.com> - 2013-09-06 14:10 -0400
Re: Trying to utilize mailx to send mail via apython script Ferrous Cranus <nikos@superhost.gr> - 2013-09-07 08:33 +0300
Re: Trying to utilize mailx to send mail via apython script "Jonathan N. Little" <lws4art@gmail.com> - 2013-09-07 08:33 -0400
Re: Trying to utilize mailx to send mail via apython script Ferrous Cranus <nikos@superhost.gr> - 2013-09-07 23:24 +0300
Re: Trying to utilize mailx to send mail via apython script "Jonathan N. Little" <lws4art@gmail.com> - 2013-09-07 16:54 -0400
Re: Trying to utilize mailx to send mail via apython script Ferrous Cranus <nikos@superhost.gr> - 2013-09-08 09:58 +0300
Re: Trying to utilize mailx to send mail via apython script Ferrous Cranus <nikos@superhost.gr> - 2013-09-08 10:57 +0300
Re: Trying to utilize mailx to send mail via apython script "Jonathan N. Little" <lws4art@gmail.com> - 2013-09-08 10:11 -0400
Re: Trying to utilize mailx to send mail via apython script Ferrous Cranus <nikos@superhost.gr> - 2013-09-08 17:16 +0300
Re: Trying to utilize mailx to send mail via apython script Todd <Todd@invalid.invalid> - 2013-09-08 18:23 -0700
Re: Trying to utilize mailx to send mail via apython script Todd <Todd@invalid.invalid> - 2013-09-08 18:35 -0700
Re: Trying to utilize mailx to send mail via apython script "Jonathan N. Little" <lws4art@gmail.com> - 2013-09-09 17:11 -0400
Re: Trying to utilize mailx to send mail via apython script Todd <Todd@invalid.invalid> - 2013-09-09 14:40 -0700
Re: Trying to utilize mailx to send mail via apython script "Jonathan N. Little" <lws4art@gmail.com> - 2013-09-09 18:15 -0400
Re: Trying to utilize mailx to send mail via apython script David Brown <david.brown@removethis.hesbynett.no> - 2013-09-08 16:42 +0200
Re: Trying to utilize mailx to send mail via apython script Ferrous Cranus <nikos@superhost.gr> - 2013-09-08 18:41 +0300
Re: Trying to utilize mailx to send mail via apython script Whiskers <catwheezel@operamail.com> - 2013-09-08 17:56 +0100
Re: Trying to utilize mailx to send mail via apython script Ferrous Cranus <nikos@superhost.gr> - 2013-09-09 11:09 +0300
Re: Trying to utilize mailx to send mail via apython script Whiskers <catwheezel@operamail.com> - 2013-09-09 21:31 +0100
Re: Trying to utilize mailx to send mail via apython script Jorgen Grahn <grahn+nntp@snipabacken.se> - 2013-09-09 19:35 +0000
Re: Trying to utilize mailx to send mail via apython script Todd <Todd@invalid.invalid> - 2013-09-06 00:22 -0700
Re: Trying to utilize mailx to send mail via apython script Ferrous Cranus <nikos@superhost.gr> - 2013-09-06 11:09 +0300
Re: Trying to utilize mailx to send mail via apython script Todd <Todd@invalid.invalid> - 2013-09-07 15:39 -0700
Re: Trying to utilize mailx to send mail via apython script Todd <Todd@invalid.invalid> - 2013-09-07 15:41 -0700
Re: Trying to utilize mailx to send mail via apython script Todd <Todd@invalid.invalid> - 2013-09-07 16:20 -0700
Re: Trying to utilize mailx to send mail via apython script Ferrous Cranus <nikos@superhost.gr> - 2013-09-08 09:54 +0300
Re: Trying to utilize mailx to send mail via apython script Todd <Todd@invalid.invalid> - 2013-09-08 13:15 -0700
Re: Trying to utilize mailx to send mail via apython script Ferrous Cranus <nikos@superhost.gr> - 2013-09-09 11:29 +0300
Re: Trying to utilize mailx to send mail via apython script Todd <Todd@invalid.invalid> - 2013-09-09 11:44 -0700
Re: Trying to utilize mailx to send mail via apython script Whiskers <catwheezel@operamail.com> - 2013-09-09 22:07 +0100
Re: Trying to utilize mailx to send mail via apython script "Jonathan N. Little" <lws4art@gmail.com> - 2013-09-09 17:33 -0400
Re: Trying to utilize mailx to send mail via apython script Whiskers <catwheezel@operamail.com> - 2013-09-10 16:38 +0100
Re: Trying to utilize mailx to send mail via apython script Ferrous Cranus <nikos@superhost.gr> - 2013-09-10 22:37 +0300
Re: Trying to utilize mailx to send mail via apython script David Brown <david.brown@removethis.hesbynett.no> - 2013-09-10 23:04 +0200
Re: Trying to utilize mailx to send mail via apython script Whiskers <catwheezel@operamail.com> - 2013-09-10 22:05 +0100
Re: Trying to utilize mailx to send mail via apython script David Brown <david@westcontrol.removethisbit.com> - 2013-09-06 11:10 +0200
Re: Trying to utilize mailx to send mail via apython script Ferrous Cranus <nikos@superhost.gr> - 2013-09-06 12:17 +0300
Re: Trying to utilize mailx to send mail via apython script David Brown <david.brown@removethis.hesbynett.no> - 2013-09-08 16:34 +0200
Re: Trying to utilize mailx to send mail via apython script Ferrous Cranus <nikos@superhost.gr> - 2013-09-08 18:37 +0300
Re: Trying to utilize mailx to send mail via apython script David Brown <david.brown@removethis.hesbynett.no> - 2013-09-09 01:57 +0200
csiph-web