All Downloads are FREE. Search and download functionalities are using the official Maven repository.

hudson.cli.MailCommand Maven / Gradle / Ivy

The newest version!
/*******************************************************************************
 *
 * Copyright (c) 2004-2010, Oracle Corporation.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *
 *
 *
 *
 *******************************************************************************/ 

package hudson.cli;

import hudson.Extension;
import hudson.model.Hudson;
import hudson.model.Item;
import hudson.tasks.HudsonMimeMessage;
import hudson.tasks.Mailer;

/**
 * Sends e-mail through Hudson.
 *
 * 

Various platforms have different commands to do this, so on heterogenous * platform, doing this via Hudson is easier. * * @author Kohsuke Kawaguchi */ @Extension public class MailCommand extends CLICommand { public String getShortDescription() { return "Reads stdin and sends that out as an e-mail."; } protected int run() throws Exception { Hudson.getInstance().checkPermission(Item.CONFIGURE); Mailer.DescriptorImpl descriptor = Mailer.descriptor(); descriptor.send(new HudsonMimeMessage(descriptor.createSession(), stdin)); return 0; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy