PDA

Bekijk de volledige versie : Email from router



Googol
25-05-2005, 11:35
How do I email from my router? I have Olegs firmware version 1.9.2.7-5a installed on my router. In earlier releases (1.7.x I believe it was) sendmail was installed but I cannot find it any more. What happened to sendmail? Is there another email client available?

barsju
25-05-2005, 11:40
Try mini_sendmail.
B.

macsat
25-05-2005, 12:58
..or you could try with esmtp.

esmtp can be installed using ipkg :


ipkg install esmtp

You should place a config ( esmtprc ) file in your /opt/etc directory :



hostname = smtp.isp.com:25
username = "user"
password = "password"


where smtp.isp.com should be your ISP smtp server.
User + password are only important if your ISP smtp server requires this.

now you can use /opt/sbin/sendmail as you would normally use sendmail on your localhost.

TuTu
11-06-2005, 22:21
some mail servers with TTL might require adding "starttls required" into the esmtprc :)

kiewer
16-09-2005, 17:09
..or you could try with esmtp.
I've installed according your tutorial. Installation fine, but when I try to send something like:


$ echo "Test Message" | sendmail user@domain.com -f user@domain.com

I do not get prompt back. When I try to exit with Ctrl-Z get an error message:


[1] + CPU time limit exceeded echo "Test Message" | ...

Tryed to remove and install again. Doesn't help.

Could anybody help?
Thanks.

kiewer
17-09-2005, 09:10
When I try to exit with Ctrl-Z get an error message:


[1] + CPU time limit exceeded echo "Test Message" | ...

Tryed to remove and install again. Doesn't help.

Could anybody help?
Thanks.
May be it is normal behavior on pressing Ctrl-Z (stop job), but nevertheless esmtp doesn't work.

kiewer
18-09-2005, 08:49
Now tryed with port 587 instead of port 465 and there is some update on my problem with esmtp and gmail.com (google) account:

with /opt/etc/esmtprc (doesn't matter whether starttls = enabled or required):


hostname = smtp.gmail.com:587

username = "xxxxxxx.x@gmail.com"
password = "xxxxxxx"
starttls = enabled

result:


$ echo "Test Message" | /opt/sbin/sendmail xxxxxxxx.x@gmail.com
Invalid peer certificate (error 20)
0 (null)
xxxxxxxx.x@gmail.com: 0 (null)

and with following /opt/etc/esmtprc:


hostname = smtp.gmail.com:587

identity = "xxx@xxxxx.xxx"
username = "xxxxxxx.x@gmail.com"
password = "xxxxxx"
starttls = enabled
result:



$ echo "Test Message" | /opt/sbin/sendmail xxxxxxxx.x@gmail.com
0 (null)
xxxxxxxx.x@gmail.com: 0 (null)

and no emails arrive to google.

I've also found in Internet an advice to use stunnel especially for getting working esmtp with google account, but may be there is a more simple solution?

likeapear
18-04-2006, 07:19
I've installed according your tutorial. Installation fine, but when I try to send something like:


$ echo "Test Message" | sendmail user@domain.com -f user@domain.com

I do not get prompt back. When I try to exit with Ctrl-Z get an error message:


[1] + CPU time limit exceeded echo "Test Message" | ...

Tryed to remove and install again. Doesn't help.

Could anybody help?
Thanks.

Exactly same problem as you described. Do you have solved it?

oleo
18-04-2006, 07:33
There is no need to install any package for sending mail. There is utility in Oleg firmware called mini_sendmail which can send simple mail messages.


usage: mini_sendmail [-f<name>] [-t] [-s<server>] [-T<timeout>] [-v] [address ...]

likeapear
18-04-2006, 07:47
There is no need to install any package for sending mail. There is utility in Oleg firmware called mini_sendmail which can send simple mail messages.


usage: mini_sendmail [-f<name>] [-t] [-s<server>] [-T<timeout>] [-v] [address ...]

Great! I will try it.

likeapear
20-04-2006, 09:43
There is no need to install any package for sending mail. There is utility in Oleg firmware called mini_sendmail which can send simple mail messages.


usage: mini_sendmail [-f<name>] [-t] [-s<server>] [-T<timeout>] [-v] [address ...]

Tried it. Working perfectly, but I dont know how to set the subject, sender name and recipients addresses...


echo "huhu" | mini_sendmail -fmyrouter -smysmtpserver.com address@domain.com

...sends the e-mail with blank subject, sender is address@domain.com and recipients are undisclosed-recipients:;

What to do???

Hellish
22-04-2006, 18:37
Tried it. Working perfectly, but I dont know how to set the subject, sender name and recipients addresses...


echo "huhu" | mini_sendmail -fmyrouter -smysmtpserver.com address@domain.com

...sends the e-mail with blank subject, sender is address@domain.com and recipients are undisclosed-recipients:;

What to do???

What sre the arguments? What is myrouter and waht is mysmtpserver?
Does that mean you have to have an email server/smtp server installed on the router?
If so, how does it send webcam alerts then whithout the WAN connected?

sodb
23-04-2006, 21:04
echo -e "From: test@test.com\nSubject: this is the subject\nReply-to: reply@server.com\nHere goes the mail body" | mini_sendmail -fnotused@ -ssmtp.server.com recipient@testide.com where -e option in echo interprets special \n character as a newline. The -f option in mini_sendmail does not seem to be used at all.

oleo
24-04-2006, 07:41
-f option is used when talking to SMTP server. It should be a valid username to bypass antispam and other filters.

If no -f arguments are given admin@hostname is used and this is not a valid domain for most SMTP servers.



mini_sendmail(8) mini_sendmail(8)



NAME
mini_sendmail - accept email on behalf of real sendmail

SYNOPSIS
mini_sendmail [-f<name>] [-t] [-s<server>] [-T<timeout>] [-v] address
...

DESCRIPTION
With no flags, mini_sendmail reads its standard input up to an end-of-
file and sends a copy of the message found there to all of the
addresses listed.

The message is sent by connecting to a local SMTP server. This means
mini_sendmail can be used to send email from inside a chroot(2) area.

-f Set the name of the "from" person (i.e. the sender of the mail).

-t Read message for recipients. To:, Cc:, and Bcc: lines will be
scanned for recipient addresses. The Bcc: line will be deleted
before transmission.

-s Specify the the SMTP server to use. Without this it uses local-
host.

-T Specify timeout - defaults to one minute.

-v Verbose mode - show the conversation with the SMTP server.

SEE ALSO
sendmail(8)

AUTHOR
Copyright &#169; 1999 by Jef Poskanzer <jef@acme.com>. All rights reserved.



12 July 2001 mini_sendmail(8)

Hellish
25-04-2006, 21:42
Thanx for the reply. I got it finally working. Though I am trying to send myself email when router restarts that means I set the destination email address and the email address after the -f option to the same (my own address).
When I get the message from my mail account and view it in my mail client the "Message from" field is empty. But I guess that is done by the mail server as it (as I suppose) does this automatically for mails that are sent from and to the same address.

Thanx for your help and for explaining the parameters :)

dccharacter
25-11-2006, 19:25
echo -e "From: test@test.com\nSubject: this is the subject\nReply-to: reply@server.com\nHere goes the mail body" | mini_sendmail -fnotused@ -ssmtp.server.com recipient@testide.com where -e option in echo interprets special \n character as a newline. The -f option in mini_sendmail does not seem to be used at all.

I still can't get - how authentication's done? Or should I look for an smtp serv over internet which does not require authentication? :confused:

btw, trying to get logrotate working - probably shouldn't and everything's already done? :-)

oleo
27-11-2006, 20:00
SMTP uses no authentication.
Just use addresses of a server where you have an email account. The server should not be spam protected with grey listing or something similar.

dccharacter
27-11-2006, 21:27
SMTP uses no authentication.
Just use addresses of a server where you have an email account. The server should not be spam protected with grey listing or something similar.
I believe this is not correct. As far as I'm concerned smtp protocol does not HAVE authentication feature, which does not mean it does not require to do it. Some servers (like mail.ru) require a user to login to pop3 server first, and some require starttsl (like gmail.com). Correct me if I'm wrong.

anyway, I tried just what you recommend, and can't send a message and if I turn on verbose servers tell me that I have to do with authentication.

oleo
28-11-2006, 08:05
pop3 is not smtp. pop3 is for fetching mail only. Basic smtp uses no authentication. Reasonable servers only accept mail for their domains. If TLS is used or some filtering is ongoing on server, I recommend to create account on some free mail server and configure mail forwarding.

dccharacter
12-12-2006, 19:06
pop3 is not smtp. pop3 is for fetching mail only. Basic smtp uses no authentication. Reasonable servers only accept mail for their domains. If TLS is used or some filtering is ongoing on server, I recommend to create account on some free mail server and configure mail forwarding.

Believe it or not - didn't know that :-) Thanks a lot!

Jarex
14-12-2006, 17:00
What kind of command in script should I use to send info about lack of power (router's restart)? I have running sendmail very well. I need to know only command for that.

dccharacter
16-12-2006, 13:43
What kind of command in script should I use to send info about lack of power (router's restart)? I have running sendmail very well. I need to know only command for that.



echo -e "From: test@test.com\nSubject: this is the subject\nReply-to: reply@server.com\nHere goes the mail body" | mini_sendmail -fnotused@ -ssmtp.server.com recipient@testide.com

Jarex
17-12-2006, 08:30
Entire form i know very well. I need to know only command to use in script to send info about router's restart and how to tell CRON to start script after restart of router? Is "-fnotused@" the one? Looks strange...I do not get it.

I use esmtp and sendmail command (in script) instead of mini-sendmail. I am able to add a topic to email etc.

dccharacter
17-12-2006, 11:45
Entire form i know very well. I need to know only command to use in script to send info about router's restart and how to tell CRON to start script after restart of router? Is "-fnotused@" the one? Looks strange...I do not get it.

I use esmtp and sendmail command (in script) instead of mini-sendmail. I am able to add a topic to email etc.

Put a script in cron.5mins that cheks uptime and if it is less than 5 mins, run mini_sendmail. I'm not a guru who can write a script just like that, but I presume this is very simple, one conditional command call. I don't have linux at my hands right now, so you're on you're own...

Jarex
17-12-2006, 17:03
Thx m8. That is a good point to build a script with uptime. I am not script guru either but will try make one for my own purpose. ;)


Finally I made it. It works superb!

georgij
02-03-2007, 16:19
Hi

I want to send email when router is powered on. I put this line in my post-mount script

/opt/sbin/sendmail sendto@gmail.com -f myemail@gmail.com < /tmp/harddisk/mimofile
Post-mount is OK and is exectable. Problem is that mail is not send. But when I put this line manualy via telnet console it works.
So where can I see logs of post-boot to get what goes wrong.

oleo
02-03-2007, 17:30
add >> /tmp/startup.log 2>&1 at the end of commands you wish to debug. eg.

/opt/sbin/sendmail sendto@gmail.com -f myemail@gmail.com < /tmp/harddisk/mimofile > /tmp/startup.log 2>&1
and also

echo "mini_sendmail status $?" >> /tmp/startup.log"
after command in question.

What about post-firewall?

georgij
03-03-2007, 13:15
This is not working for me

Post-firewall is never executed. Don't know why

Router is in access point mode

oleo
04-03-2007, 10:56
no post-firewall in AP mode!

georgij
04-03-2007, 13:51
As I undrestand, I am not able to use post-firewall when in AP mode.
But post-mount & post-boot are not usable for programs which uses network

So what should I do. I just need to run program after router is configured.
Maby cron can be hacked somehow

oleo
04-03-2007, 16:47
(sleep 30; mini_sendmail ....) &

sonice
20-03-2008, 16:31
I still can't get - how authentication's done? Or should I look for an smtp serv over internet which does not require authentication? :confused:

btw, trying to get logrotate working - probably shouldn't and everything's already done? :-)

Thanks, I installed esmtp and created a simlink

ln -s /opt/bin/esmtp /opt/sbin/sendmail

and with this line

echo -e "From: myname@gmail.com\nSubject: this is the subject\nReply-to: myname@gmail.com\nHere goes the mail body" | sendmail -myname@ -ssmtp.gmail.com myname@gmail.com

I have got this responce-Failed to parse headers

and with this line-
/opt/bin/esmtp mymail@gmail.com -f mymail@gmail.com

I have such repy-
0 (null)
mymail@gmail.com: 0 (null)

Any idea?

sarlacc
04-09-2008, 12:29
Did you get the mailserver working? I'm also looking for a mailserver on the Asus WL500g. Is there any good and simple howto?

krajicek
26-08-2010, 07:32
Hi lads,

I'm looking for "router logs to email" script so just checking if somebody got sending mails from RT-N16 on Oleg's firmware working?
If so please share your knowledge.

Thank you in advance
krajicek