I currently have Jenkins setup to send through an AWS SMTP server, but I would like to change this so that I can send emails directly on the local network.
I have sendmail installed on the server, and a terminal test proves that Sendmail can transmit emails to an external address, so I know this is working, but I can't for the life of me get Jenkins to send directly via SendMail.
The few examples I find suggest Jenkins and SendMail are all I need but if that's the case then the setup doesn't work.
Please advise.
Jenkins sends email via SMTP so as long as you have sendmail listening on loopback and configured to accept email it should work as long as you put localhost as the mail server
I run into this problem today. Here is my solution for anyone who is looking for answer of the same problem.
If you don't want to setup a smtp provider such as gmail, you can install postfix (see here about how to install postfix non-interactively) on the maschine/container on which Jenkins is running.
Make sure postfix runs well. In my case postfix did not start automatically after installation.
service postfix start
Then in Jenkins select Manage Jenkins => Configure System => Email Notification. Enter localhost In field "SMTP Server". Let Jenkins send out a test mail to test it.
I need to configure sendmail in order to test websites and app mail function locally;
I wish that if on production a mail() function sends a mail to user#hisdomain.com, the same code tested locally sends a mail to myfolder#localhost in order to check messages details, functionalities and so on.
I'm on a LAMP machine.
Is it possible?
You may configure sendmail to deliver all outgoing mail to local mailbox/alias.
It should catch all message to non local mailboxes.
sendmail.mc file (used to generate sendmail.cf file):
define(`SMART_HOST`,`local:myfolder`)dnl
Restart/reload sendmail daemon after compiling new sendmail.cf file from sendmail.mc file.
i am new to grails ,
i created a new project to check mail plugin.
In the controller i added the following command in index
sendMail {
to "my_mailid#gmail.com"
from "another_valid_id #gmail.com"
subject "link test"
body 'haiiii'
//html g.render(template:"mailtemplate",model:[code:UUID.randomUUID().toString()])
}
render "send"
when i am running the application it shows no error and display send in browser. but when i am checking the my mail inbox mail is not reached.
i didn't done any changes in config file. as it by default works in localhost and in port 25.
thankz in advance
http://grails.org/plugin/mail
By default the plugin assumes an unsecured mail server configured at localhost on port 25. However you can change this via the grails-app/Config.groovy file.
It assumes an unsecured mail server on your localhost on port 25. If there isn't one running there, it won't send mail. I'm not sure what your operating system is, but if you are on a mac or *nix system, postfix comes installed.
sudo postfix start
If you're on Windows you can find an alternative. Honestly, it's easy to simply configure to send from a gmail account which is what I have done for my clients. You can see how to do that at the link above.
How do i send mail on my ubuntu system. I need to send mail in my ruby on rails application but can't test, because mail isn't being sent. What do i need to do on my system. (now testing this app is making me realize why mail wasn't being sent through that Evolution thing i have installed)
The Evolution thing is an MUA (Mail User Agent) like Outlook, Thunderbird, or any number of programs intended for user to read and create email messages. Your program is also a limited MUA (likely creation only).
You need to send your e-mail to an MTA (Mail Transfer Agent). If you configure the return address correctly, you may be able to use the same MTA that you connect to with Evolution. In this case the SMTP server used to send email. If you are using one of the e-mail libraries you should be able to specify the SMTP server name as well as a user-id and password if required.
Many packages require an MTA so you may have Postfix, Exim4, or Sendmail already installed. Check for programs listening on port 25. If so you can use localhost as your SMTP server. If you need to send email other systems you may need to configure your MTA as a satellite to your ISPs server which will relay your message out to the Internet.
I have a computer at home which I can't access from work. I'd like to be able to view results from work that my home computer produces. The best idea I've come up with is an automated script running on my home computer that emails myself the results (from a text file or stderr/out) when complete.
I'm decent with bash (I have a linux machine) and java, so an answer using either or both of those would be ideal, but if there's something easier that's fine too.
I typically use gmail, but also have yahoo mail.
My question is this: what would be the basic steps in solving this problem? I can do the nitty gritty stuff, but can't really get the big picture of how something like this would work.
Please help.
jbu
Howto set up ssmtp to send through a Gmail account
Some of the steps here might seem strange at first, but the rationale is put
in footnotes that should hopefully explain why.
First create a spare account on gmail which you will only use for
sending email. For instance, if your normal account is user#gmail.com,
create an account user.noreply#gmail.com with a newly created password
which you only will use for this account [1].
Set up the new account to forward all email to the normal account [2]
and under account settings you should add all other email adresses you
use [3].
Then install ssmtp (On Debian: aptitude install ssmtp) and edit ssmtp's configuration file /etc/ssmtp/ssmtp.conf:
root=user#gmail.com
mailhub=smtp.gmail.com:587
UseSTARTTLS=YES
AuthUser=user.noreply
AuthPass=passwdusedonlyforthisaccount
FromLineOverride=YES
and configure the local mail delivery by editing /etc/ssmtp/revaliases
assuming that your local login is localuser:
root:user#gmail.com:smtp.gmail.com:587
localuser:user#gmail.com:smtp.gmail.com:587
Make sure the two configuration files are readable to all users who
should be able to send email [4].
Test the setup by e.g. mailx (On Debian: aptitude install bsd-mailx):
echo 'testing, one, two' | mailx -s 'test 1' user#gmail.com
Hope this helps.
[1] The new gmail user name and password will be visible to everyone who
can log onto your machine, so you do not want this account to be
critical in any way, meaning you can close it down immediately if
someone should get access to it.
[2] If some email you sent bounces back to you, you might want to know
about it, and there actually exists people who will happily reply to an
email from johnsmith.noreply.
[3] Gmail will rewrite the From header on the email if it does not recognise the address.
[4] Ssmtp runs as the local user who sends the email, so that user needs
read access to the configuration files.
On any Linux I have used the mail sending from command-line is simple:
mail -s "My subject here" recipient#wherever.com <message_body.txt
AFAIK this acts as a front-end to sendmail, and you have to have sendmail configured to forward the messages to your ISP mail server.
You can't access your home computer from work which rules out a "remote support" option.
Can you access other computers on the Internet? If so, you could simply set up one of the online storage options and then ftp the results from your home computer. That's a lot simpler then trying to write scripts or code to generate emails with attachments or whatever.
You could then view the external computer from work.
If you have netcat, this command will send you an e-mail:
Given a file in this format (from Wikipedia):
HELO relay.example.org
MAIL FROM:<bob#example.org>
RCPT TO:<alice#example.com>
RCPT TO:<theboss#example.com>
DATA
From: "Bob Example" <bob#example.org>
To: Alice Example <alice#example.com>
Cc: theboss#example.com
Date: Tue, 15 Jan 2008 16:02:43 -0500
Subject: Test message
Hello Alice.
This is a test message with 5 headers and 4 lines in the body.
Your friend,
Bob
.
QUIT
Then netcat it to an SMTP server you have access to:
nc mail.somewhere.com 25 < file.txt
This will then send the e-mail. You can see how you can create a Java program to do this for you (just execute the commands).
Traditionaly, with unix systems like Linux, you'd have an MTA, a mail transfer agent, on the computer that deals with sending e-mail.
This could be a full blown e-mail server like exim, or something simple like ssmtp that just sends messages on to a relaying SMTP server such as would be provided by your ISP.
This isn't neccessarily the case anymore, since mail clients like Thunderbird include their own MTA, much like mail clients on Windows do.
However, it is likely that your distro will install some MTA or other by default, if for no other reason than the fact that other things on your system, like cron, want to be able to send e-mail. Generally there will be a command line tool called sendmail (sendmail being the original MTA [citation needed], other MTAs maintain compatability with its interface and it has sort of become the standard) that can be used from a shell script to send an e-mail.
My solution assumes that you have a SMTP server available which allows you to send an email programmatically. Alternatively, you can use a local install of sendmail which generally is available with most linux distros.
Create a standalone java program which watches the directory your home computer saves the file to. Use the JavaMail API to attach and send the file to any email you wish.
If you're also familiar with the Spring Framework, it has a nice abstraction layer for working with JavaMail and makes this sort of thing trivial.
Of course, your home ISP probably has the common SMTP port blocked as well.