Discussion:
Trying to utilize mailx to send mail via apython script
(too old to reply)
Ferrous Cranus
2013-09-05 16:11:21 UTC
Permalink
i as root just installed

sendmail and mailx. i have edited the ~/.mailrc to use:


***@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.
Jorgen Grahn
2013-09-05 18:13:50 UTC
Permalink
Post by Ferrous Cranus
i as root just installed
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
Where did you learn about this .mailrc syntax? It doesn't match the
one documented in mailx(1) on my machines. (That's BSD mailx; there
seems to be two different flavors, but I don't think they are /that/
radically different.)

There are two ways to send mail on Unix:

1 Enqueue it to the local MTA using /usr/lib/sendmail. The local MTA
then becomes responsible for passing it on, if needed. This is the
traditional approach used by at, cron, mail, mailx, mutt ...

2 Send it via SMTP to some external mail relay. Local mail won't
work, every mail client must be configured, and temporary delivery
problems will be fatal.

You seem to have the software for (1), but the configuration for (2).

...
Post by Ferrous Cranus
cmd = "echo %s | mailx -A gmail -r %s -s %s %s" % (MESSAGE, FROM,
SUBJECT, TO)
p=subprocess.Popen( cmd, shell=True, stdout=subprocess.PIPE )
...

Make it work from the command line before attempting to automate it.

(You may also want to avoid invoking the shell. Think about what
might happen if MESSAGE=="; rm -rf $HOME ;".)

/Jorgen
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
Ferrous Cranus
2013-09-06 06:19:35 UTC
Permalink
Post by Jorgen Grahn
Post by Ferrous Cranus
cmd = "echo %s | mailx -A gmail -r %s -s %s %s" % (MESSAGE, FROM,
SUBJECT, TO)
p=subprocess.Popen( cmd, shell=True, stdout=subprocess.PIPE )
...
Make it work from the command line before attempting to automate it.
(You may also want to avoid invoking the shell. Think about what
might happen if MESSAGE=="; rm -rf $HOME ;".)
Hello,

Even so, even trying it from the shell that is, 'mailx' fails to
delivers my test mails.

Can one helo me congigure sendmail properly?


mailX == an MUA == a Mail Client right?
sendmail == MTA == program that is responsilble to send mails?

So, i gather 'mailx' does use 'sendmail' to send mail yes?

can you provide me a working mail exmaple that works?

Why i can only send mail to local server addresses an not to an external
mail address?
--
Webhost <http://superhost.gr>
Jorgen Grahn
2013-09-06 08:50:54 UTC
Permalink
Post by Ferrous Cranus
Post by Jorgen Grahn
Post by Ferrous Cranus
cmd = "echo %s | mailx -A gmail -r %s -s %s %s" % (MESSAGE, FROM,
SUBJECT, TO)
p=subprocess.Popen( cmd, shell=True, stdout=subprocess.PIPE )
...
Make it work from the command line before attempting to automate it.
(You may also want to avoid invoking the shell. Think about what
might happen if MESSAGE=="; rm -rf $HOME ;".)
Hello,
Even so, even trying it from the shell that is, 'mailx' fails to
delivers my test mails.
Yes, that's exactly my point. It's a general problem solving trick:
if you can split your problem in two parts, try to solve one at a
time.
Post by Ferrous Cranus
Can one helo me congigure sendmail properly?
mailX == an MUA == a Mail Client right?
sendmail == MTA == program that is responsilble to send mails?
So, i gather 'mailx' does use 'sendmail' to send mail yes?
Yes, the version of mailx I am used to[1] does that ... but apparently
you and the other posters are using some /other/ tool with the same
name.
Post by Ferrous Cranus
can you provide me a working mail exmaple that works?
Sorry; no. I use neither sendmail nor gmail.
Post by Ferrous Cranus
Why i can only send mail to local server addresses an not to an external
mail address?
Don't know, but remember that local mail is a lot easier. As long as
you have an MTA (e.g. sendmail) running and its config is not horribly
broken, local->local will work.

/Jorgen

[1] Mailx is /old/. I used it on SunOS 20 years ago, and it wasn't
new then.
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
Ferrous Cranus
2013-09-06 09:06:01 UTC
Permalink
Post by Jorgen Grahn
Post by Ferrous Cranus
Why i can only send mail to local server addresses an not to an external
mail address?
Don't know, but remember that local mail is a lot easier. As long as
you have an MTA (e.g. sendmail) running and its config is not horribly
broken, local->local will work.
I have managed already to make it work local=>local

But then how about local => internet

what configurations should i do? try to run what condig?

Is there an alternative that will help me send mails more easily?
--
Webhost <http://superhost.gr>
Jonathan N. Little
2013-09-06 18:10:29 UTC
Permalink
Post by Ferrous Cranus
Post by Jorgen Grahn
Post by Ferrous Cranus
Why i can only send mail to local server addresses an not to an external
mail address?
Don't know, but remember that local mail is a lot easier. As long as
you have an MTA (e.g. sendmail) running and its config is not horribly
broken, local->local will work.
I have managed already to make it work local=>local
But then how about local => internet
If you are only going it that direction "local => internet" and
"internet" is gmail a simple solution is sSMTP.

https://wiki.debian.org/sSMTP
https://wiki.archlinux.org/index.php/SSMTP

I use it for remote servers to send error messages and info via scripts
to an "admin" gmail account.

Very simple to setup and works with gmail. Works for me to keep tabs on
various servers I maintain.
--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Ferrous Cranus
2013-09-07 05:33:52 UTC
Permalink
Post by Jonathan N. Little
Post by Ferrous Cranus
Post by Jorgen Grahn
Post by Ferrous Cranus
Why i can only send mail to local server addresses an not to an external
mail address?
Don't know, but remember that local mail is a lot easier. As long as
you have an MTA (e.g. sendmail) running and its config is not horribly
broken, local->local will work.
I have managed already to make it work local=>local
But then how about local => internet
If you are only going it that direction "local => internet" and
"internet" is gmail a simple solution is sSMTP.
https://wiki.debian.org/sSMTP
https://wiki.archlinux.org/index.php/SSMTP
I use it for remote servers to send error messages and info via scripts
to an "admin" gmail account.
Very simple to setup and works with gmail. Works for me to keep tabs on
various servers I maintain.
Can i use my own FROM field with sSMTP?
But connecting to google's smtp server will still add a Sender header.
--
Webhost <http://superhost.gr>
Jonathan N. Little
2013-09-07 12:33:20 UTC
Permalink
Post by Ferrous Cranus
Post by Jonathan N. Little
Post by Ferrous Cranus
Post by Jorgen Grahn
Post by Ferrous Cranus
Why i can only send mail to local server addresses an not to an external
mail address?
Don't know, but remember that local mail is a lot easier. As long as
you have an MTA (e.g. sendmail) running and its config is not horribly
broken, local->local will work.
I have managed already to make it work local=>local
But then how about local => internet
If you are only going it that direction "local => internet" and
"internet" is gmail a simple solution is sSMTP.
https://wiki.debian.org/sSMTP
https://wiki.archlinux.org/index.php/SSMTP
I use it for remote servers to send error messages and info via scripts
to an "admin" gmail account.
Very simple to setup and works with gmail. Works for me to keep tabs on
various servers I maintain.
Can i use my own FROM field with sSMTP?
Yes. I even add "X-*" headers for sorting done within my scripts, Perl
and shell scripts so would be no problem with Python.
Post by Ferrous Cranus
But connecting to google's smtp server will still add a Sender header.
Not for the from From field, but the hostname is recorded in Received
field...but maybe I am misunderstanding your question.
--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Ferrous Cranus
2013-09-07 20:24:30 UTC
Permalink
Post by Jonathan N. Little
Post by Ferrous Cranus
Post by Jonathan N. Little
Post by Ferrous Cranus
Post by Jorgen Grahn
Post by Ferrous Cranus
Why i can only send mail to local server addresses an not to an external
mail address?
Don't know, but remember that local mail is a lot easier. As long as
you have an MTA (e.g. sendmail) running and its config is not horribly
broken, local->local will work.
I have managed already to make it work local=>local
But then how about local => internet
If you are only going it that direction "local => internet" and
"internet" is gmail a simple solution is sSMTP.
https://wiki.debian.org/sSMTP
https://wiki.archlinux.org/index.php/SSMTP
I use it for remote servers to send error messages and info via scripts
to an "admin" gmail account.
Very simple to setup and works with gmail. Works for me to keep tabs on
various servers I maintain.
Can i use my own FROM field with sSMTP?
Yes. I even add "X-*" headers for sorting done within my scripts, Perl
and shell scripts so would be no problem with Python.
Post by Ferrous Cranus
But connecting to google's smtp server will still add a Sender header.
Not for the from From field, but the hostname is recorded in Received
field...but maybe I am misunderstanding your question.
is there a way to send mail from the mail address i specify and without
the hostname of my server being revealed?
--
Webhost <http://superhost.gr>
Jonathan N. Little
2013-09-07 20:54:24 UTC
Permalink
Post by Ferrous Cranus
Post by Jonathan N. Little
Post by Ferrous Cranus
Post by Jonathan N. Little
Post by Ferrous Cranus
Post by Jorgen Grahn
Post by Ferrous Cranus
Why i can only send mail to local server addresses an not to an external
mail address?
Don't know, but remember that local mail is a lot easier. As long as
you have an MTA (e.g. sendmail) running and its config is not horribly
broken, local->local will work.
I have managed already to make it work local=>local
But then how about local => internet
If you are only going it that direction "local => internet" and
"internet" is gmail a simple solution is sSMTP.
https://wiki.debian.org/sSMTP
https://wiki.archlinux.org/index.php/SSMTP
I use it for remote servers to send error messages and info via scripts
to an "admin" gmail account.
Very simple to setup and works with gmail. Works for me to keep tabs on
various servers I maintain.
Can i use my own FROM field with sSMTP?
Yes. I even add "X-*" headers for sorting done within my scripts, Perl
and shell scripts so would be no problem with Python.
Post by Ferrous Cranus
But connecting to google's smtp server will still add a Sender header.
Not for the from From field, but the hostname is recorded in Received
field...but maybe I am misunderstanding your question.
is there a way to send mail from the mail address i specify and without
the hostname of my server being revealed?
Well reading the man it says <http://linux.die.net/man/5/ssmtp.conf>
it says:

"Hostname
The full qualified name of the host. If not specified, the host is
queried for its hostname. "

So to test I used "bogus.nowhere.invalid" and that is what is in the
header for "Received:" fields. This is independent of the "From:" field
which you can set with your script if your enable it in the ssmtp.conf.
But note your external IP will be recorded though, no way around that I
would guess without a proxy.
--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Ferrous Cranus
2013-09-08 06:58:12 UTC
Permalink
Post by Jonathan N. Little
Post by Ferrous Cranus
Post by Jonathan N. Little
Post by Ferrous Cranus
Post by Jonathan N. Little
Post by Ferrous Cranus
Post by Jorgen Grahn
Post by Ferrous Cranus
Why i can only send mail to local server addresses an not to an external
mail address?
Don't know, but remember that local mail is a lot easier. As long as
you have an MTA (e.g. sendmail) running and its config is not horribly
broken, local->local will work.
I have managed already to make it work local=>local
But then how about local => internet
If you are only going it that direction "local => internet" and
"internet" is gmail a simple solution is sSMTP.
https://wiki.debian.org/sSMTP
https://wiki.archlinux.org/index.php/SSMTP
I use it for remote servers to send error messages and info via scripts
to an "admin" gmail account.
Very simple to setup and works with gmail. Works for me to keep tabs on
various servers I maintain.
Can i use my own FROM field with sSMTP?
Yes. I even add "X-*" headers for sorting done within my scripts, Perl
and shell scripts so would be no problem with Python.
Post by Ferrous Cranus
But connecting to google's smtp server will still add a Sender header.
Not for the from From field, but the hostname is recorded in Received
field...but maybe I am misunderstanding your question.
is there a way to send mail from the mail address i specify and without
the hostname of my server being revealed?
Well reading the man it says <http://linux.die.net/man/5/ssmtp.conf>
"Hostname
The full qualified name of the host. If not specified, the host is
queried for its hostname. "
So to test I used "bogus.nowhere.invalid" and that is what is in the
header for "Received:" fields. This is independent of the "From:" field
which you can set with your script if your enable it in the ssmtp.conf.
But note your external IP will be recorded though, no way around that I
would guess without a proxy.
I want to avoid using GMail's service because it adds up a Sender:
header saying 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. Pehars by using
a proxy.
Can ssmtp handle this?

I cannot even download ssmtp when i 'yum install ssmtp'

where can i find it as a package and can you please provide me a
ssmtp.conf file that does the above( set its own FROM field and alter
hostname)

Thank you.
--
Webhost <http://superhost.gr>
Ferrous Cranus
2013-09-08 07:57:39 UTC
Permalink
Post by Ferrous Cranus
Post by Jonathan N. Little
Post by Ferrous Cranus
Post by Jonathan N. Little
Post by Ferrous Cranus
Post by Jonathan N. Little
Post by Ferrous Cranus
Post by Jorgen Grahn
Post by Ferrous Cranus
Why i can only send mail to local server addresses an not to an external
mail address?
Don't know, but remember that local mail is a lot easier. As long as
you have an MTA (e.g. sendmail) running and its config is not horribly
broken, local->local will work.
I have managed already to make it work local=>local
But then how about local => internet
If you are only going it that direction "local => internet" and
"internet" is gmail a simple solution is sSMTP.
https://wiki.debian.org/sSMTP
https://wiki.archlinux.org/index.php/SSMTP
I use it for remote servers to send error messages and info via scripts
to an "admin" gmail account.
Very simple to setup and works with gmail. Works for me to keep tabs on
various servers I maintain.
Can i use my own FROM field with sSMTP?
Yes. I even add "X-*" headers for sorting done within my scripts, Perl
and shell scripts so would be no problem with Python.
Post by Ferrous Cranus
But connecting to google's smtp server will still add a Sender header.
Not for the from From field, but the hostname is recorded in Received
field...but maybe I am misunderstanding your question.
is there a way to send mail from the mail address i specify and without
the hostname of my server being revealed?
Well reading the man it says <http://linux.die.net/man/5/ssmtp.conf>
"Hostname
The full qualified name of the host. If not specified, the host is
queried for its hostname. "
So to test I used "bogus.nowhere.invalid" and that is what is in the
header for "Received:" fields. This is independent of the "From:" field
which you can set with your script if your enable it in the ssmtp.conf.
But note your external IP will be recorded though, no way around that I
would guess without a proxy.
header saying 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. Pehars by using
a proxy.
Can ssmtp handle this?
I cannot even download ssmtp when i 'yum install ssmtp'
where can i find it as a package and can you please provide me a
ssmtp.conf file that does the above( set its own FROM field and alter
hostname)
Thank you.
I cannot evn decide if i need an external mail server or setup my own
mail server.
--
Webhost <http://superhost.gr>
Jonathan N. Little
2013-09-08 14:11:01 UTC
Permalink
Post by Ferrous Cranus
Post by Jonathan N. Little
Post by Ferrous Cranus
Post by Jonathan N. Little
Post by Ferrous Cranus
Post by Jonathan N. Little
Post by Ferrous Cranus
Post by Jorgen Grahn
Post by Ferrous Cranus
Why i can only send mail to local server addresses an not to an external
mail address?
Don't know, but remember that local mail is a lot easier. As long as
you have an MTA (e.g. sendmail) running and its config is not horribly
broken, local->local will work.
I have managed already to make it work local=>local
But then how about local => internet
If you are only going it that direction "local => internet" and
"internet" is gmail a simple solution is sSMTP.
https://wiki.debian.org/sSMTP
https://wiki.archlinux.org/index.php/SSMTP
I use it for remote servers to send error messages and info via scripts
to an "admin" gmail account.
Very simple to setup and works with gmail. Works for me to keep tabs on
various servers I maintain.
Can i use my own FROM field with sSMTP?
Yes. I even add "X-*" headers for sorting done within my scripts, Perl
and shell scripts so would be no problem with Python.
Post by Ferrous Cranus
But connecting to google's smtp server will still add a Sender header.
Not for the from From field, but the hostname is recorded in Received
field...but maybe I am misunderstanding your question.
is there a way to send mail from the mail address i specify and without
the hostname of my server being revealed?
Well reading the man it says <http://linux.die.net/man/5/ssmtp.conf>
"Hostname
The full qualified name of the host. If not specified, the host is
queried for its hostname. "
So to test I used "bogus.nowhere.invalid" and that is what is in the
header for "Received:" fields. This is independent of the "From:" field
which you can set with your script if your enable it in the ssmtp.conf.
But note your external IP will be recorded though, no way around that I
would guess without a proxy.
header saying 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. Pehars by using
a proxy.
Can ssmtp handle this?
I cannot even download ssmtp when i 'yum install ssmtp'
What distro are you using? Ubuntu/Debian has it in the standard repos
and one of the links on configuration was for Arch
Post by Ferrous Cranus
where can i find it as a package and can you please provide me a
ssmtp.conf file that does the above( set its own FROM field and alter
hostname)
The ssmtp.conf should be in /etc/ssmtp/ssmtp.conf if you installed the
package.
--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Ferrous Cranus
2013-09-08 14:16:53 UTC
Permalink
Post by Jonathan N. Little
Post by Ferrous Cranus
header saying 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. Pehars by using
a proxy.
Can ssmtp handle this?
I cannot even download ssmtp when i 'yum install ssmtp'
What distro are you using? Ubuntu/Debian has it in the standard repos
and one of the links on configuration was for Arch
Post by Ferrous Cranus
where can i find it as a package and can you please provide me a
ssmtp.conf file that does the above( set its own FROM field and alter
hostname)
The ssmtp.conf should be in /etc/ssmtp/ssmtp.conf if you installed the
package.
i use CentOS 6.4 and yum install ssmtp cannot detect it.

Please if you comment in for my other questions too.
--
Webhost <http://superhost.gr>
Todd
2013-09-09 01:23:56 UTC
Permalink
Post by Ferrous Cranus
i use CentOS 6.4 and yum install ssmtp cannot detect it.
Please if you comment in for my other questions too.
$ cat /etc/redhat-release
Scientific Linux release 6.4 (Carbon)

$ yum --enablerepo=* whatprovides ssmtpssmtp-2.61-19.el6.x86_64 :
Extremely simple MTA to get mail off the system to a Mailhub
Repo : epel



...
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
the riddle wrapped in an enigma wrapped
in a couple slices of baloney
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Todd
2013-09-09 01:35:54 UTC
Permalink
Post by Todd
Post by Ferrous Cranus
i use CentOS 6.4 and yum install ssmtp cannot detect it.
Please if you comment in for my other questions too.
$ cat /etc/redhat-release
Scientific Linux release 6.4 (Carbon)
Extremely simple MTA to get mail off the system to a Mailhub
Repo : epel
You can download this from pbone.net, if you don't want to
get install EPEL repo.

Also, I never got ssmtp to work with gmail.

-T
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
the riddle wrapped in an enigma wrapped
in a couple slices of baloney
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jonathan N. Little
2013-09-09 21:11:01 UTC
Permalink
Post by Todd
Post by Todd
Post by Ferrous Cranus
i use CentOS 6.4 and yum install ssmtp cannot detect it.
Please if you comment in for my other questions too.
$ cat /etc/redhat-release
Scientific Linux release 6.4 (Carbon)
Extremely simple MTA to get mail off the system to a Mailhub
Repo : epel
You can download this from pbone.net, if you don't want to
get install EPEL repo.
Also, I never got ssmtp to work with gmail.
Really? I usually use nullmailer but it does not work with gmail.
ssmtp was the only thing that I got to work with gmail on several
computers. Generally what I do to assist in remote administration for
servers. I create a gmail account for error messages and notices, use
ssmtp to setup a lightweight smtp "server" My scripts email warnings,
errors, and messages to that account and the server admins only have to
monitor that email account from anywhere...
--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Todd
2013-09-09 21:40:51 UTC
Permalink
Post by Jonathan N. Little
Post by Todd
Also, I never got ssmtp to work with gmail.
Really? I usually use nullmailer but it does not work with gmail.
It took me several days to figure out how to get mailx to
work with gmail and zmail. I was pretty frazzled by
the end of it. Probably contributed with me not getting
ssmtp working
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
the riddle wrapped in an enigma wrapped
in a couple slices of baloney
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jonathan N. Little
2013-09-09 22:15:44 UTC
Permalink
Post by Todd
Post by Jonathan N. Little
Post by Todd
Also, I never got ssmtp to work with gmail.
Really? I usually use nullmailer but it does not work with gmail.
It took me several days to figure out how to get mailx to
work with gmail and zmail. I was pretty frazzled by
the end of it. Probably contributed with me not getting
ssmtp working
Other than installing it edit the /etc/ssmtp/ssmtp.conf to something
like this change what is obvious:

# /etc/ssmtp/ssmtp.conf
# Sample Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
root=***@gmail.com
UseTLS=YES
UseSTARTTLS=YES
mailhub=smtp.gmail.com:587
# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=YES
#
# Username and password for Google's Gmail servers
# From addresses are settled by Mutt's rc file, so
# with this setup one can still achieve multi-user SMTP
AuthUser=***@gmail.com
AuthPass=YOUR_GMAIL_PASSWORD

Then you might like to setup alias like as follows:

#/etc/ssmtp/revaliases
# sSMTP aliases
#
# Format: local_account:outgoing_address:mailhub
#
# Some common handy examples to redirect system script messages
root:***@gmail.com
postmaster:***@gmail.com


And you can test it out with the bash one-liner

echo -e "TO: Admin <***@gmail.com>\nFROM: test
<***@invalid>\nSUBJECT: A Test\nA sample message" | $(which sendmail)
***@gmail.com
--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
David Brown
2013-09-08 14:42:43 UTC
Permalink
Post by Ferrous Cranus
header saying 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
If I understand you correctly here, you want a visitor to be able to put
a "To" address and a "From" address, and you want to pass on the mail
with those addresses and no others.

Let me know if you get it working - I'll sell the website's address to
spammers for a substantial fee.


Put another way, do /not/ do this. If you are sending email, then /you/
are sending it. If /your/ server is sending email, then the "from" and
"sender" addresses should be /your/ server or related email addresses.
It is basically fraud to say that someone else sent the email, even if
that someone had filled in the web form for the email.
Post by Ferrous Cranus
Also it would be nice if the hostname would appear too. Pehars by using
a proxy.
Can ssmtp handle this?
Most SMTP clients - ssmtp, Python's SMTP module, or anything else other
than a standard email program (which tend to be a bit limited) can put
anything you want in any field.
Ferrous Cranus
2013-09-08 15:41:47 UTC
Permalink
Post by David Brown
Put another way, do /not/ do this. If you are sending email, then /you/
are sending it. If /your/ server is sending email, then the "from" and
"sender" addresses should be /your/ server or related email addresses.
It is basically fraud to say that someone else sent the email, even if
that someone had filled in the web form for the email.
No it is not.

My web form at http://superhost.gr ask the visitor for his mail address
and asks him for the subject to.

I want those the visitor used to be seen as FROM and MESSAGE and not my
gmail addres as sender.

Is there a way to make this work?
--
Webhost <http://superhost.gr>
Whiskers
2013-09-08 16:56:33 UTC
Permalink
Post by Ferrous Cranus
Post by David Brown
Put another way, do /not/ do this. If you are sending email, then /you/
are sending it. If /your/ server is sending email, then the "from" and
"sender" addresses should be /your/ server or related email addresses.
It is basically fraud to say that someone else sent the email, even if
that someone had filled in the web form for the email.
No it is not.
My web form at http://superhost.gr ask the visitor for his mail address
and asks him for the subject to.
I want those the visitor used to be seen as FROM and MESSAGE and not my
gmail addres as sender.
Is there a way to make this work?
If you use the Gmail SMTP server to deliver an email, you cannot stop
Google from adding whatever header information they want.

Google may well object to your Gmail account being used to send emails
not coming from you, indeed they should reject any such email - and
terminate your Gmail account if it happens more than a few times. The
only exception may be that Google will let you 'register' particular
email addresses which are not provided by them, so that you can send
messages 'from' those addresses using their server; I don't know if
Google charge extra for that service. The headers available to the
recipient will show that Gmail have 'relayed' the message, and will show
the public IP number of the internet connection used for initiating the
email, and whatever hostname your system identifies itself with when
logging in to the Gmail server.

If your visitors have email addresses of their own already, why not let
them log in to their own email accounts instead of trying to use your
Gmail account?
--
-- ^^^^^^^^^^
-- Whiskers
-- ~~~~~~~~~~
Ferrous Cranus
2013-09-09 08:09:54 UTC
Permalink
Post by Whiskers
The
only exception may be that Google will let you 'register' particular
email addresses which are not provided by them, so that you can send
messages 'from' those addresses using their server; I don't know if
Google charge extra for that service.
What do you mean by Google letting me 'register' some mail address?
I dont unserstand that sentence.

Will it still add up Sender Header of it own?
--
Webhost <http://superhost.gr>
Whiskers
2013-09-09 20:31:25 UTC
Permalink
Post by Ferrous Cranus
Post by Whiskers
The
only exception may be that Google will let you 'register' particular
email addresses which are not provided by them, so that you can send
messages 'from' those addresses using their server; I don't know if
Google charge extra for that service.
What do you mean by Google letting me 'register' some mail address?
I dont unserstand that sentence.
Go to <https://support.google.com/mail/answer/22370?hl=en-GB&ctx=mail>
"Sending mail from a different address".

,----
| Gmail lets you send messages with another of your email addresses listed
| as the sender instead of your Gmail address. This feature helps you
| manage multiple accounts from the Gmail interface; it works only if you
| already own the email account linked to the alternate address. [...]
`----
Post by Ferrous Cranus
Will it still add up Sender Header of it own?
I wouldn't be at all surprised. If you don't want Google to 'stamp'
your mail, don't send it using Google.
--
-- ^^^^^^^^^^
-- Whiskers
-- ~~~~~~~~~~
Jorgen Grahn
2013-09-09 19:35:04 UTC
Permalink
On Sun, 2013-09-08, Ferrous Cranus wrote:
...
Post by Ferrous Cranus
header saying 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
You've mentioned this several times. What's the problem? It seems like
a sane and sensible thing for GMail to do, and also a harmless one.
RFC 2822 indicates Sender: and From: can be seen as "the guy who sent
the message; pressed the button" and "the guy who wrote it and is
responsible for it".

And doesn't that describe what you're aiming for?

The originator fields of a message consist of the from field, the
sender field (when applicable), and optionally the reply-to field.
... If the from field contains more than one mailbox specification
in the mailbox-list, then the sender field ... MUST appear in the
message. In either case, an optional reply-to field MAY also be
included ...

The originator fields indicate the mailbox(es) of the source of the
message. The "From:" field specifies the author(s) of the message,
that is, the mailbox(es) of the person(s) or system(s) responsible
for the writing of the message. The "Sender:" field specifies the
mailbox of the agent responsible for the actual transmission of the
message. For example, if a secretary were to send a message for
another person, the mailbox of the secretary would appear in the
"Sender:" field and the mailbox of the actual author would appear in
the "From:" field. ...

The originator fields also provide the information required when
replying to a message. When the "Reply-To:" field is present, it
indicates the mailbox(es) to which the author of the message suggests
that replies be sent. In the absence of the "Reply-To:" field,
replies SHOULD by default be sent to the mailbox(es) specified in the
"From:" field unless otherwise specified by the person composing the
reply.

This part is also nice:

In all cases, the "From:" field SHOULD NOT contain any mailbox that
does not belong to the author(s) of the message.

/Jorgen
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
Todd
2013-09-06 07:22:45 UTC
Permalink
Post by Ferrous Cranus
i as root just installed
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
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
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=***@gmail.com \
-S smtp-auth-user=***@gmail.com \
-S smtp-auth-password="Your_email_password" \
-S nss-config-dir=/home/linuxutil/mailcerts/ \
***@gmail.com
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
the riddle wrapped in an enigma wrapped
in a couple slices of baloney
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ferrous Cranus
2013-09-06 08:09:50 UTC
Permalink
Post by Todd
Post by Ferrous Cranus
i as root just installed
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
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
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 smtp-auth-password="Your_email_password" \
-S nss-config-dir=/home/linuxutil/mailcerts/ \
***@superhost.gr [~/www/cgi-bin]# cat ~/.mailrc
account gmail {
-S smtp-use-starttls \
-S ssl-verify=ignore \
-S smtp-auth=login \
-S smtp=smtp://smtp.gmail.com:587 \
-S from=***@gmail.com \
-S smtp-auth-user=***@gmail.com \
-S smtp-auth-password="my_gmail_pass" \
-S nss-config-dir=/home/nikos/certs/ \
***@ath.forthnet.gr
}

==============================

cmd = "echo %s | mailx -v 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 )


================================


Output of my attempt to send mail:

***@superhost.gr [~/www/cgi-bin]# python mail.py
LOG: MAIN
cwd=/home/nikos/public_html/cgi-bin 9 args: send-mail -i -v -r -s
***@YEG0WH73G3.com
BD1ZJHE1340OB76AYIM81YP51VBYFCR5B2BCH08LKVT06T5I9E gmail
***@gmail.com
LOG: MAIN
<= -***@secure.superhost.gr U=nikos P=local S=1125
Content-type: text/html; charset=utf-8

None b''
<h2><font color=blue>Ευχαριστώ πολύ για το ενδιαφέρον! Θα επικοινωνήσω
μαζί σου άμεσα :-)</font></h2>
LOG: MAIN
cwd=/var/spool/exim 4 args: /usr/sbin/exim -v -Mc 1VHr2Y-0004wE-RL
delivering 1VHr2Y-0004wE-RL
***@superhost.gr [~/www/cgi-bin]# LOG: MAIN
SMTP connection outbound 1378454714 1VHr2Y-0004wE-RL superhost.gr
***@gmail.com
LOG: MAIN
SMTP connection outbound 1378454714 1VHr2Y-0004wE-RL superhost.gr
***@secure.superhost.gr
LOG: MAIN
remote host address is the local host: secure.superhost.gr
LOG: MAIN
== ***@secure.superhost.gr R=lookuphost defer (-1): remote host
address is the local host
LOG: MAIN
SMTP connection outbound 1378454715 1VHr2Y-0004wE-RL superhost.gr
***@secure.superhost.gr
LOG: MAIN
remote host address is the local host: secure.superhost.gr
LOG: MAIN
==
***@secure.superhost.gr
<***@secure.superhost.gr>
R=lookuphost defer (-1): remote host address is the local host
LOG: MAIN
SMTP connection outbound 1378454715 1VHr2Y-0004wE-RL superhost.gr
***@yeg0wh73g3.com
LOG: MAIN
** ***@yeg0wh73g3.com <***@YEG0WH73G3.com>
R=fail_remote_domains: The mail server could not deliver mail to
***@yeg0wh73g3.com. The account or domain may not exist, they
may be blacklisted, or missing the proper dns entries.
Connecting to gmail-smtp-in.l.google.com [173.194.70.26]:25 ... connected
SMTP<< 220 mx.google.com ESMTP w44si1186161eef.195 - gsmtp
SMTP>> EHLO secure.superhost.gr
SMTP<< 250-mx.google.com at your service, [84.200.17.58]
250-SIZE 35882577
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250 CHUNKING
SMTP>> STARTTLS
SMTP<< 220 2.0.0 Ready to start TLS
SMTP>> EHLO secure.superhost.gr
SMTP<< 250-mx.google.com at your service, [84.200.17.58]
250-SIZE 35882577
250-8BITMIME
250-ENHANCEDSTATUSCODES
250 CHUNKING
SMTP>> MAIL FROM:<-***@secure.superhost.gr> SIZE=2165
SMTP<< 250 2.1.0 OK w44si1186161eef.195 - gsmtp
SMTP>> RCPT TO:<***@gmail.com>
SMTP<< 250 2.1.5 OK w44si1186161eef.195 - gsmtp
SMTP>> DATA
SMTP<< 354 Go ahead w44si1186161eef.195 - gsmtp
SMTP>> writing message and terminating "."
SMTP<< 250 2.0.0 OK 1378454716 w44si1186161eef.195 - gsmtp
SMTP>> QUIT
LOG: MAIN
=> ***@gmail.com R=lookuphost T=remote_smtp
H=gmail-smtp-in.l.google.com [173.194.70.26] X=TLSv1:RC4-SHA:128
LOG: MAIN
**
***@secure.superhost.gr:
retry timeout exceeded
LOG: MAIN
** ***@secure.superhost.gr: retry timeout exceeded
LOG: MAIN
cwd=/var/spool/exim 8 args: /usr/sbin/exim -v -t -oem -oi -f <>
-E1VHr2Y-0004wE-RL
LOG: MAIN
<= <> R=1VHr2Y-0004wE-RL U=mailnull P=local S=2374 T="Mail delivery
failed: returning message to sender"
LOG: MAIN
Completed
LOG: MAIN
cwd=/var/spool/exim 4 args: /usr/sbin/exim -v -Mc 1VHr2a-0004wK-G7
delivering 1VHr2a-0004wK-G7
LOG: MAIN
remote host address is the local host: secure.superhost.gr
LOG: MAIN
== -***@secure.superhost.gr R=dkim_lookuphost defer (-1): remote host
address is the local host
LOG: MAIN
** -***@secure.superhost.gr: retry timeout exceeded
LOG: MAIN
-***@secure.superhost.gr: error ignored
LOG: MAIN
Completed



I have pasted the .mailrc, the snippet of mail.py and the output

Can you help based on that info please?
--
Webhost <http://superhost.gr>
Todd
2013-09-07 22:39:45 UTC
Permalink
Post by Ferrous Cranus
Post by Ferrous Cranus
Post by Ferrous Cranus
i as root just installed
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
Post by Ferrous Cranus
}e
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
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 smtp-auth-password="Your_email_password" \
-S nss-config-dir=/home/linuxutil/mailcerts/ \
account gmail {
-S smtp-use-starttls \
-S ssl-verify=ignore \
-S smtp-auth=login \
-S smtp=smtp://smtp.gmail.com:587 \
-S smtp-auth-password="my_gmail_pass" \
-S nss-config-dir=/home/nikos/certs/ \
}
==============================
cmd = "echo %s | mailx -v 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 )
================================
LOG: MAIN
cwd=/home/nikos/public_html/cgi-bin 9 args: send-mail -i -v -r -s
BD1ZJHE1340OB76AYIM81YP51VBYFCR5B2BCH08LKVT06T5I9E gmail
LOG: MAIN
Content-type: text/html; charset=utf-8
None b''
<h2><font color=blue>Ευχαριστώ πολύ για το ενδιαφέρον! Θα επικοινωνήσω
μαζί σου άμεσα :-)</font></h2>
LOG: MAIN
cwd=/var/spool/exim 4 args: /usr/sbin/exim -v -Mc 1VHr2Y-0004wE-RL
delivering 1VHr2Y-0004wE-RL
SMTP connection outbound 1378454714 1VHr2Y-0004wE-RL superhost.gr
LOG: MAIN
SMTP connection outbound 1378454714 1VHr2Y-0004wE-RL superhost.gr
LOG: MAIN
remote host address is the local host: secure.superhost.gr
LOG: MAIN
address is the local host
LOG: MAIN
SMTP connection outbound 1378454715 1VHr2Y-0004wE-RL superhost.gr
LOG: MAIN
remote host address is the local host: secure.superhost.gr
LOG: MAIN
==
R=lookuphost defer (-1): remote host address is the local host
LOG: MAIN
SMTP connection outbound 1378454715 1VHr2Y-0004wE-RL superhost.gr
LOG: MAIN
R=fail_remote_domains: The mail server could not deliver mail to
may be blacklisted, or missing the proper dns entries.
Connecting to gmail-smtp-in.l.google.com [173.194.70.26]:25 ... connected
SMTP<< 220 mx.google.com ESMTP w44si1186161eef.195 - gsmtp
SMTP>> EHLO secure.superhost.gr
SMTP<< 250-mx.google.com at your service, [84.200.17.58]
250-SIZE 35882577
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250 CHUNKING
SMTP>> STARTTLS
SMTP<< 220 2.0.0 Ready to start TLS
SMTP>> EHLO secure.superhost.gr
SMTP<< 250-mx.google.com at your service, [84.200.17.58]
250-SIZE 35882577
250-8BITMIME
250-ENHANCEDSTATUSCODES
250 CHUNKING
SMTP<< 250 2.1.0 OK w44si1186161eef.195 - gsmtp
SMTP<< 250 2.1.5 OK w44si1186161eef.195 - gsmtp
SMTP>> DATA
SMTP<< 354 Go ahead w44si1186161eef.195 - gsmtp
SMTP>> writing message and terminating "."
SMTP<< 250 2.0.0 OK 1378454716 w44si1186161eef.195 - gsmtp
SMTP>> QUIT
LOG: MAIN
H=gmail-smtp-in.l.google.com [173.194.70.26] X=TLSv1:RC4-SHA:128
LOG: MAIN
**
retry timeout exceeded
LOG: MAIN
LOG: MAIN
cwd=/var/spool/exim 8 args: /usr/sbin/exim -v -t -oem -oi -f <>
-E1VHr2Y-0004wE-RL
LOG: MAIN
<= <> R=1VHr2Y-0004wE-RL U=mailnull P=local S=2374 T="Mail delivery
failed: returning message to sender"
LOG: MAIN
Completed
LOG: MAIN
cwd=/var/spool/exim 4 args: /usr/sbin/exim -v -Mc 1VHr2a-0004wK-G7
delivering 1VHr2a-0004wK-G7
LOG: MAIN
remote host address is the local host: secure.superhost.gr
LOG: MAIN
address is the local host
LOG: MAIN
LOG: MAIN
LOG: MAIN
Completed
I have pasted the .mailrc, the snippet of mail.py and the output
Can you help based on that info please?
Don't use mailrc until you get it working from a batch file.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
the riddle wrapped in an enigma wrapped
in a couple slices of baloney
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Todd
2013-09-07 22:41:29 UTC
Permalink
Please elaborate.
--
Webhost <http://superhost.gr>
replying over on comp.os.linux.networking
Todd
2013-09-07 23:20:51 UTC
Permalink
On 09/06/2013 12:37 AM, Νίκος - Support wrote:> Στις 6/9/2013 10:20 πμ,
Post by Todd
Post by Ferrous Cranus
i as root just installed
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
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
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 smtp-auth-password="Your_email_password" \
-S nss-config-dir=/home/linuxutil/mailcerts/ \
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=***@gmail.com \
-S smtp-auth-user=***@gmail.com \
-S smtp-auth-password="From_email_password" \
-S nss-config-dir=/home/linuxutil/mailcerts/ \
***@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
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
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Computers are like air conditioners.
They malfunction when you open windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ferrous Cranus
2013-09-08 06:54:03 UTC
Permalink
Post by Todd
On 09/06/2013 12:37 AM, Νίκος - Support wrote:> Στις 6/9/2013 10:20 πμ,
Post by Todd
Post by Ferrous Cranus
i as root just installed
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
Post by Todd
Post by Ferrous Cranus
}e
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
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 smtp-auth-password="Your_email_password" \
-S nss-config-dir=/home/linuxutil/mailcerts/ \
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 smtp-auth-password="From_email_password" \
-S nss-config-dir=/home/linuxutil/mailcerts/ \
---------------------------------------------------
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
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
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

***@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=***@gmail.com \
-S smtp-auth-user=***@gmail.com \
-S smtp-auth-password="my_gmail_pass" \
-S nss-config-dir=/home/nikos/certs/ \
***@ath.forthnet.gr

chmod u+x MailXTest.gmail

and finally when i try to run it:

***@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>
Todd
2013-09-08 20:15:04 UTC
Permalink
Post by Ferrous Cranus
Post by Todd
On 09/06/2013 12:37 AM, Νίκος - Support wrote:> Στις 6/9/2013 10:20 πμ,
Post by Todd
Post by Ferrous Cranus
i as root just installed
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
Post by Todd
Post by Ferrous Cranus
}e
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
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",
Post by Todd
"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 smtp-auth-password="Your_email_password" \
-S nss-config-dir=/home/linuxutil/mailcerts/ \
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 smtp-auth-password="From_email_password" \
-S nss-config-dir=/home/linuxutil/mailcerts/ \
---------------------------------------------------
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
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
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!
rm ~./mailrc
#!/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 smtp-auth-password="my_gmail_pass" \
-S nss-config-dir=/home/nikos/certs/ \
chmod u+x 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?
`dnsdomainname` gives you both your hostname and your domain
name. Try just running the command by itself from the command
line.

Note sure what you mean by "visitor used". Is the visitor's
address what you want to use as "From:"? If so, it needs to
be a gMail account and you need to use his info in
"from=", "smtp-auth-user=", and "smtp-auth-password=".

If "visitor" is not a gMail account, you need to find out
what the SMTP settings are for his account.

Not sure what is going on. Here is a scatter gun approach.

1) is "mailx" install and at the latest version? From
the command line, run the following to see if it
is there and in your path:
which mailx

2) try putting "./" in front of the MailXTest.gmail.
./MailXTest.gmail

3) "from=" and "smtp-auth-user=" should be the same
thing (***@gmail.com).

4) try adding tracing to the script. On line one, add "-x"
#!/bin/bash -x
if there is a problem, it will show you where

-T
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
the riddle wrapped in an enigma wrapped
in a couple slices of baloney
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ferrous Cranus
2013-09-09 08:29:20 UTC
Permalink
Post by Todd
Post by Ferrous Cranus
Post by Todd
On 09/06/2013 12:37 AM, Νίκος - Support wrote:> Στις 6/9/2013 10:20 πμ,
Post by Todd
Post by Ferrous Cranus
i as root just installed
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
Post by Todd
Post by Ferrous Cranus
}e
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
Post by Todd
Post by Ferrous Cranus
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",
Post by Todd
"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 smtp-auth-password="Your_email_password" \
-S nss-config-dir=/home/linuxutil/mailcerts/ \
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 smtp-auth-password="From_email_password" \
-S nss-config-dir=/home/linuxutil/mailcerts/ \
---------------------------------------------------
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
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
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!
rm ~./mailrc
#!/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 smtp-auth-password="my_gmail_pass" \
-S nss-config-dir=/home/nikos/certs/ \
chmod u+x 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?
`dnsdomainname` gives you both your hostname and your domain
name. Try just running the command by itself from the command
line.
Note sure what you mean by "visitor used". Is the visitor's
address what you want to use as "From:"? If so, it needs to
be a gMail account and you need to use his info in
"from=", "smtp-auth-user=", and "smtp-auth-password=".
If "visitor" is not a gMail account, you need to find out
what the SMTP settings are for his account.
Not sure what is going on. Here is a scatter gun approach.
1) is "mailx" install and at the latest version? From
the command line, run the following to see if it
which mailx
2) try putting "./" in front of the MailXTest.gmail.
./MailXTest.gmail
3) "from=" and "smtp-auth-user=" should be the same
4) try adding tracing to the script. On line one, add "-x"
#!/bin/bash -x
if there is a problem, it will show you where
-T
***@superhost.gr [~]# ./MailXTest.gmail
Send options without primary recipient specified.
Usage: mailx -eiIUdEFntBDNHRV~ -T FILE -u USER -h hops -r address -s
SUBJECT -a FILE -q FILE -f FILE -A ACCOUNT -b USERS -c USERS -S OPTION users
./MailXTest.gmail: line 4: -S: command not found
***@superhost.gr [~]# cat MailXTest.gmail
#!/bin/bash -x
#
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=***@gmail.com \
-S smtp-auth-user=***@gmail.com \
-S smtp-auth-password="pass" \
-S nss-config-dir=/home/nikos/certs/ \
***@ath.forthnet.gr

The visitor of http://superhost.gr tried to send me an email using the
wb gorm i ahve which asks for his mail address and MESSAGE he wans to
send me.

i have no way of knowing the smtp settings the visitor uses or even if
his mail address is real but no matter what, the the FROM field must
contain the mail address the user types in the web form.
--
Webhost <http://superhost.gr>
Todd
2013-09-09 18:44:36 UTC
Permalink
Post by Ferrous Cranus
i have no way of knowing the smtp settings the visitor uses or even if
his mail address is real but no matter what, the the FROM field must
contain the mail address the user types in the web form.
You should create a special eMail address of your own for
these messages and use that to send with. "Supposedly"
(note the weasel word), "-S from=" and "-S smtp-auth-user="
can be different.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
the riddle wrapped in an enigma wrapped
in a couple slices of baloney
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Whiskers
2013-09-09 21:07:34 UTC
Permalink
Post by Ferrous Cranus
Post by Todd
On 09/06/2013 12:37 AM, Νίκος - Support wrote:> Στις 6/9/2013 10:20 πμ,
[...]
Post by Ferrous Cranus
The visitor of http://superhost.gr tried to send me an email using the
wb gorm i ahve which asks for his mail address and MESSAGE he wans to
send me.
i have no way of knowing the smtp settings the visitor uses or even if
his mail address is real but no matter what, the the FROM field must
contain the mail address the user types in the web form.
That's fine, but only while the email is on your own system. If you
want users of your system to be able to send local emails to you and
other local users, each user should have a username of their own which
they use to log in to your system, and the computer they use will have a
hostname; those two things combine to create email addresses that are
valid for use within your own system - "***@localhost" or
"***@upstairs.computer" or "***@kitchen.sink" or whatever. This sort
of arrangement is not usually worth the bother, apart from getting
system status and error reports sent to the system administrator by the
various 'daemons' or 'services' you have running.

If you want to allow visitors to access their existing Gmail accounts
from your computer, just set up a limited user called (for example)
guest, with access only to a web browser - possibly in 'kiosk mode' - so
that they can log in using the same login details as they do from
anywhere else.

Or are you trying to become an email service provider yourself?
--
-- ^^^^^^^^^^
-- Whiskers
-- ~~~~~~~~~~
Jonathan N. Little
2013-09-09 21:33:10 UTC
Permalink
Post by Whiskers
Post by Ferrous Cranus
Post by Todd
On 09/06/2013 12:37 AM, Νίκος - Support wrote:> Στις 6/9/2013 10:20 πμ,
[...]
Post by Ferrous Cranus
The visitor of http://superhost.gr tried to send me an email using the
wb gorm i ahve which asks for his mail address and MESSAGE he wans to
send me.
i have no way of knowing the smtp settings the visitor uses or even if
his mail address is real but no matter what, the the FROM field must
contain the mail address the user types in the web form.
That's fine, but only while the email is on your own system. If you
want users of your system to be able to send local emails to you and
other local users, each user should have a username of their own which
they use to log in to your system, and the computer they use will have a
hostname; those two things combine to create email addresses that are
of arrangement is not usually worth the bother, apart from getting
system status and error reports sent to the system administrator by the
various 'daemons' or 'services' you have running.
If you want to allow visitors to access their existing Gmail accounts
from your computer, just set up a limited user called (for example)
guest, with access only to a web browser - possibly in 'kiosk mode' - so
that they can log in using the same login details as they do from
anywhere else.
Or are you trying to become an email service provider yourself?
It sounds more like the OP is trying to setup form to mail and wishes to
validate if the visitor's supplied email address in his form is valid.
Well, there is no real way to do this one shot. If he is using that form
to create a auto-reply with that user supplied address he better take
measures to prevent robo comment spam.
--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Whiskers
2013-09-10 15:38:20 UTC
Permalink
Post by Jonathan N. Little
Post by Whiskers
Post by Ferrous Cranus
Post by Todd
On 09/06/2013 12:37 AM, Νίκος - Support wrote:> Στις 6/9/2013 10:20 πμ,
[...]
Post by Ferrous Cranus
The visitor of http://superhost.gr tried to send me an email using the
wb gorm i ahve which asks for his mail address and MESSAGE he wans to
send me.
i have no way of knowing the smtp settings the visitor uses or even if
his mail address is real but no matter what, the the FROM field must
contain the mail address the user types in the web form.
That's fine, but only while the email is on your own system. If you
want users of your system to be able to send local emails to you and
other local users, each user should have a username of their own which
they use to log in to your system, and the computer they use will have a
hostname; those two things combine to create email addresses that are
of arrangement is not usually worth the bother, apart from getting
system status and error reports sent to the system administrator by the
various 'daemons' or 'services' you have running.
If you want to allow visitors to access their existing Gmail accounts
from your computer, just set up a limited user called (for example)
guest, with access only to a web browser - possibly in 'kiosk mode' - so
that they can log in using the same login details as they do from
anywhere else.
Or are you trying to become an email service provider yourself?
It sounds more like the OP is trying to setup form to mail and wishes to
validate if the visitor's supplied email address in his form is valid.
Well, there is no real way to do this one shot. If he is using that form
to create a auto-reply with that user supplied address he better take
measures to prevent robo comment spam.
Might be useful to clarify whether the OP wants the visitor's message to
be sent *to* the OP's Gmail address, eg as feedback from a website, or
wants the visitor to be able to send emails to anyone by *relaying*
through Google's SMTP server using the OP's Google account but with
unspecified or invented 'From' addresses.

The latter should not be permitted by Google or any other email service
provider, of course.

<http://www.nixtutor.com/linux/send-mail-with-gmail-and-ssmtp/>
<https://wiki.archlinux.org/index.php/SSMTP#Forward_to_a_Gmail_Mail_Server>
<http://heirloom.sourceforge.net/mailx.html>
--
-- ^^^^^^^^^^
-- Whiskers
-- ~~~~~~~~~~
Ferrous Cranus
2013-09-10 19:37:29 UTC
Permalink
Post by Whiskers
Post by Jonathan N. Little
Post by Whiskers
Post by Ferrous Cranus
Post by Todd
On 09/06/2013 12:37 AM, Νίκος - Support wrote:> Στις 6/9/2013 10:20 πμ,
[...]
Post by Ferrous Cranus
The visitor of http://superhost.gr tried to send me an email using the
wb gorm i ahve which asks for his mail address and MESSAGE he wans to
send me.
i have no way of knowing the smtp settings the visitor uses or even if
his mail address is real but no matter what, the the FROM field must
contain the mail address the user types in the web form.
That's fine, but only while the email is on your own system. If you
want users of your system to be able to send local emails to you and
other local users, each user should have a username of their own which
they use to log in to your system, and the computer they use will have a
hostname; those two things combine to create email addresses that are
of arrangement is not usually worth the bother, apart from getting
system status and error reports sent to the system administrator by the
various 'daemons' or 'services' you have running.
If you want to allow visitors to access their existing Gmail accounts
from your computer, just set up a limited user called (for example)
guest, with access only to a web browser - possibly in 'kiosk mode' - so
that they can log in using the same login details as they do from
anywhere else.
Or are you trying to become an email service provider yourself?
It sounds more like the OP is trying to setup form to mail and wishes to
validate if the visitor's supplied email address in his form is valid.
Well, there is no real way to do this one shot. If he is using that form
to create a auto-reply with that user supplied address he better take
measures to prevent robo comment spam.
Might be useful to clarify whether the OP wants the visitor's message to
be sent *to* the OP's Gmail address, eg as feedback from a website, or
wants the visitor to be able to send emails to anyone by *relaying*
through Google's SMTP server using the OP's Google account but with
unspecified or invented 'From' addresses.
The latter should not be permitted by Google or any other email service
provider, of course.
<http://www.nixtutor.com/linux/send-mail-with-gmail-and-ssmtp/>
<https://wiki.archlinux.org/index.php/SSMTP#Forward_to_a_Gmail_Mail_Server>
<http://heirloom.sourceforge.net/mailx.html>
What i want is for my weboage to notify me for the visitors spcified
mail address and message and this be done by setting up my won mail
server because gmail's tend to alter the from address.
--
Webhost <http://superhost.gr>
David Brown
2013-09-10 21:04:07 UTC
Permalink
Post by Ferrous Cranus
Post by Whiskers
Post by Jonathan N. Little
Post by Whiskers
Post by Ferrous Cranus
Post by Todd
On 09/06/2013 12:37 AM, Νίκος - Support wrote:> Στις 6/9/2013
10:20 πμ,
[...]
Post by Ferrous Cranus
The visitor of http://superhost.gr tried to send me an email using the
wb gorm i ahve which asks for his mail address and MESSAGE he wans to
send me.
i have no way of knowing the smtp settings the visitor uses or even if
his mail address is real but no matter what, the the FROM field must
contain the mail address the user types in the web form.
That's fine, but only while the email is on your own system. If you
want users of your system to be able to send local emails to you and
other local users, each user should have a username of their own which
they use to log in to your system, and the computer they use will have a
hostname; those two things combine to create email addresses that are
of arrangement is not usually worth the bother, apart from getting
system status and error reports sent to the system administrator by the
various 'daemons' or 'services' you have running.
If you want to allow visitors to access their existing Gmail accounts
from your computer, just set up a limited user called (for example)
guest, with access only to a web browser - possibly in 'kiosk mode' - so
that they can log in using the same login details as they do from
anywhere else.
Or are you trying to become an email service provider yourself?
It sounds more like the OP is trying to setup form to mail and wishes to
validate if the visitor's supplied email address in his form is valid.
Well, there is no real way to do this one shot. If he is using that form
to create a auto-reply with that user supplied address he better take
measures to prevent robo comment spam.
Might be useful to clarify whether the OP wants the visitor's message to
be sent *to* the OP's Gmail address, eg as feedback from a website, or
wants the visitor to be able to send emails to anyone by *relaying*
through Google's SMTP server using the OP's Google account but with
unspecified or invented 'From' addresses.
The latter should not be permitted by Google or any other email service
provider, of course.
<http://www.nixtutor.com/linux/send-mail-with-gmail-and-ssmtp/>
<https://wiki.archlinux.org/index.php/SSMTP#Forward_to_a_Gmail_Mail_Server>
<http://heirloom.sourceforge.net/mailx.html>
What i want is for my weboage to notify me for the visitors spcified
mail address and message and this be done by setting up my won mail
server because gmail's tend to alter the from address.
Your own email server will either send via another "real" SMTP server,
such as gmail's (which will change the Sender and/or From fields), or it
will try to deliver email directly - in which case half the receiving
email servers will block it as a spam server (even if you go to all the
effort of fixed IP's, proper DNS, and proper reverse DNS, you will be
caught sending with From addresses that should not be coming from your
machine).

I don't know why this is so difficult for you to comprehend - you cannot
forge other people's From addresses and expect everything to work!

Just implement the web site in the same way everybody else does - fields
that the user enters (such as their own address) go as part of the email
contents, and the whole thing is emailed to a fixed address from a fixed
address (these can even be the same, such as your gmail address).

This is not rocket science - people have been doing it correctly for a
long time. The reason you are having such a hard time is because you
are desperately trying to misunderstand how email works, and how web
email forms work.

<http://www.freecontactform.com/html_form.php>
<http://www.templatemonster.com/help/how-create-contact-form-html.html>

(These use php rather than python, but the principle is the same.)
Whiskers
2013-09-10 21:05:58 UTC
Permalink
Post by Ferrous Cranus
Post by Whiskers
Post by Jonathan N. Little
Post by Todd
On 09/06/2013 12:37 AM, Νίκος - Support wrote:> Στις 6/9/2013 10:20 πμ,
[...]
Post by Ferrous Cranus
Post by Whiskers
Post by Jonathan N. Little
It sounds more like the OP is trying to setup form to mail and wishes to
validate if the visitor's supplied email address in his form is valid.
Well, there is no real way to do this one shot. If he is using that form
to create a auto-reply with that user supplied address he better take
measures to prevent robo comment spam.
Might be useful to clarify whether the OP wants the visitor's message to
be sent *to* the OP's Gmail address, eg as feedback from a website, or
wants the visitor to be able to send emails to anyone by *relaying*
through Google's SMTP server using the OP's Google account but with
unspecified or invented 'From' addresses.
The latter should not be permitted by Google or any other email service
provider, of course.
<http://www.nixtutor.com/linux/send-mail-with-gmail-and-ssmtp/>
<https://wiki.archlinux.org/index.php/SSMTP#Forward_to_a_Gmail_Mail_Server>
<http://heirloom.sourceforge.net/mailx.html>
What i want is for my weboage to notify me for the visitors spcified
mail address and message and this be done by setting up my won mail
server because gmail's tend to alter the from address.
Your web page cannot send an email 'From:' the visitor's email address.
It has to send emails 'From' an address which you own and using an SMTP
server associated with that email address.

If you want to know the visitor's email address, design the form to
include that as part of the 'body' of the email message the web page
sends to you (or perhaps as the 'Reply-To:' header of that message).

<https://ixquick.com/do/search?q=how+to+send+email+from+web+form>

Checking whether or not the visitor has given a real email address, is a
separate matter.
--
-- ^^^^^^^^^^
-- Whiskers
-- ~~~~~~~~~~
David Brown
2013-09-06 09:10:46 UTC
Permalink
Post by Ferrous Cranus
i as root just installed
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
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
i need to be eble to send to external mails to.
The obvious question here is why are you trying to use sendmail and
mailx? You are writing a script in Python, and you want to send mail
via an SMTP server. Just use Python's SMTP module.
Ferrous Cranus
2013-09-06 09:17:42 UTC
Permalink
Post by David Brown
Post by Ferrous Cranus
i as root just installed
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
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
i need to be eble to send to external mails to.
The obvious question here is why are you trying to use sendmail and
mailx? You are writing a script in Python, and you want to send mail
via an SMTP server. Just use Python's SMTP module.
Liek this you mean:

# open Gmail's SMTP server
#server = smtplib.SMTP('smtp.gmail.com:587')
#server.ehlo()
#server.starttls()

# next, log in to the server
#server.login("***@gmail.com", "my_pass")


Because GMail tend to add a Sender field when receiving my mail
supresing the real FROM field used in the webform to my Gmail's auth
account.

I want to avoid that by using my own mail server so my mails appear for
the correct client mail and not all of them from as coming from my GMail
account/
--
Webhost <http://superhost.gr>
David Brown
2013-09-08 14:34:47 UTC
Permalink
Post by Ferrous Cranus
Post by David Brown
Post by Ferrous Cranus
i as root just installed
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
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
i need to be eble to send to external mails to.
The obvious question here is why are you trying to use sendmail and
mailx? You are writing a script in Python, and you want to send mail
via an SMTP server. Just use Python's SMTP module.
# open Gmail's SMTP server
#server = smtplib.SMTP('smtp.gmail.com:587')
#server.ehlo()
#server.starttls()
# next, log in to the server
Because GMail tend to add a Sender field when receiving my mail
supresing the real FROM field used in the webform to my Gmail's auth
account.
I want to avoid that by using my own mail server so my mails appear for
the correct client mail and not all of them from as coming from my GMail
account/
I have no experience with GMail, but there you can put whatever you want
in the sender field (or any other field) when you connect to an SMTP
server. And the SMTP server can always choose to override fields with
its own settings if it wants. This applies equally to when you are
using Python's SMTP module to connect to the GMail server, or when you
send first to one SMTP server and relay on to GMail.

Since Python's SMTP module "speaks" SMTP to gmail, and any other mail
program or MTA that will send mail via a gmail relay also "speaks" SMTP
for that transfer, I would be very surprised if there is some effect you
can get with an additional program or relay that you cannot get by using
Python directly.

Your ISP should also have an SMTP server that you can connect to in the
same way (via Python), and send it on that way.
Ferrous Cranus
2013-09-08 15:37:10 UTC
Permalink
Post by David Brown
Post by Ferrous Cranus
Post by David Brown
Post by Ferrous Cranus
i as root just installed
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
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
i need to be eble to send to external mails to.
The obvious question here is why are you trying to use sendmail and
mailx? You are writing a script in Python, and you want to send mail
via an SMTP server. Just use Python's SMTP module.
# open Gmail's SMTP server
#server = smtplib.SMTP('smtp.gmail.com:587')
#server.ehlo()
#server.starttls()
# next, log in to the server
Because GMail tend to add a Sender field when receiving my mail
supresing the real FROM field used in the webform to my Gmail's auth
account.
I want to avoid that by using my own mail server so my mails appear for
the correct client mail and not all of them from as coming from my GMail
account/
I have no experience with GMail, but there you can put whatever you want
in the sender field (or any other field) when you connect to an SMTP
server. And the SMTP server can always choose to override fields with
its own settings if it wants. This applies equally to when you are
using Python's SMTP module to connect to the GMail server, or when you
send first to one SMTP server and relay on to GMail.
Since Python's SMTP module "speaks" SMTP to gmail, and any other mail
program or MTA that will send mail via a gmail relay also "speaks" SMTP
for that transfer, I would be very surprised if there is some effect you
can get with an additional program or relay that you cannot get by using
Python directly.
Your ISP should also have an SMTP server that you can connect to in the
same way (via Python), and send it on that way.
If i setup some mail server on localhost can i alter the from field to
the one i want and suppress the hostname of the server?

Thai is what i want to know.

GMail doesnt care what you tell it to be the FROM field, it always ads
up an authenticated Sender address into the headers and also display the
hostname used to directly connect to it.
--
Webhost <http://superhost.gr>
David Brown
2013-09-08 23:57:20 UTC
Permalink
Post by Ferrous Cranus
Post by David Brown
Post by Ferrous Cranus
Post by David Brown
Post by Ferrous Cranus
i as root just installed
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
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
i need to be eble to send to external mails to.
The obvious question here is why are you trying to use sendmail and
mailx? You are writing a script in Python, and you want to send mail
via an SMTP server. Just use Python's SMTP module.
# open Gmail's SMTP server
#server = smtplib.SMTP('smtp.gmail.com:587')
#server.ehlo()
#server.starttls()
# next, log in to the server
Because GMail tend to add a Sender field when receiving my mail
supresing the real FROM field used in the webform to my Gmail's auth
account.
I want to avoid that by using my own mail server so my mails appear for
the correct client mail and not all of them from as coming from my GMail
account/
I have no experience with GMail, but there you can put whatever you want
in the sender field (or any other field) when you connect to an SMTP
server. And the SMTP server can always choose to override fields with
its own settings if it wants. This applies equally to when you are
using Python's SMTP module to connect to the GMail server, or when you
send first to one SMTP server and relay on to GMail.
Since Python's SMTP module "speaks" SMTP to gmail, and any other mail
program or MTA that will send mail via a gmail relay also "speaks" SMTP
for that transfer, I would be very surprised if there is some effect you
can get with an additional program or relay that you cannot get by using
Python directly.
Your ISP should also have an SMTP server that you can connect to in the
same way (via Python), and send it on that way.
If i setup some mail server on localhost can i alter the from field to
the one i want and suppress the hostname of the server?
Thai is what i want to know.
GMail doesnt care what you tell it to be the FROM field, it always ads
up an authenticated Sender address into the headers and also display the
hostname used to directly connect to it.
One last time - you can do /exactly/ the same thing from Python.

<http://docs.python.org/2/library/smtplib.html#smtp-example>

And again, /don't/ do this with other people's email addresses. Unless
you are specifically making a website with this intention (i.e., a
web-based email client), then this is verging on fraud. It is certainly
not what users would expect or like.
Loading...