本文整理汇总了Java中com.google.appengine.api.mail.MailServiceFactory类的典型用法代码示例。如果您正苦于以下问题:Java MailServiceFactory类的具体用法?Java MailServiceFactory怎么用?Java MailServiceFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MailServiceFactory类属于com.google.appengine.api.mail包,在下文中一共展示了MailServiceFactory类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: reportDataCheckFailures
import com.google.appengine.api.mail.MailServiceFactory; //导入依赖的package包/类
private void reportDataCheckFailures(CheckResult result, OutputStream optionalOutput) throws IOException {
StringBuilder errorMessage = new StringBuilder();
errorMessage.append(
"\nHey,\n\n"
+ "(this message is autogenerated)\n"
+ "The iosched data updater ran but found some inconsistent data.\n"
+ "Please, check the messages below and fix the sources. "
+ "\n\n" + result.failures.size() + " data non-compliances:\n");
for (CheckFailure f: result.failures) {
errorMessage.append(f).append("\n\n");
}
if (SystemProperty.environment.value() != SystemProperty.Environment.Value.Development ||
optionalOutput == null) {
// send email if user is not running in dev or interactive mode (show=true)
Message message = new Message();
message.setSender(Config.EMAIL_TO_SEND_UPDATE_ERRORS);
message.setSubject("[iosched-data-error] Updater - Inconsistent data");
message.setTextBody(errorMessage.toString());
MailServiceFactory.getMailService().sendToAdmins(message);
} else {
// dump errors to optionalOutput
optionalOutput.write(errorMessage.toString().getBytes());
}
}
开发者ID:The-WebOps-Club,项目名称:saarang-iosched,代码行数:27,代码来源:APIUpdater.java
示例2: reportDataCheckFailures
import com.google.appengine.api.mail.MailServiceFactory; //导入依赖的package包/类
private void reportDataCheckFailures(CheckResult result, OutputStream optionalOutput) throws IOException {
StringBuilder errorMessage = new StringBuilder();
errorMessage.append(
"\nHey,\n\n"
+ "(this message is autogenerated)\n"
+ "The devfestnorte data updater ran but found some inconsistent data.\n"
+ "Please, check the messages below and fix the sources. "
+ "\n\n" + result.failures.size() + " data non-compliances:\n");
for (CheckFailure f: result.failures) {
errorMessage.append(f).append("\n\n");
}
if (SystemProperty.environment.value() != SystemProperty.Environment.Value.Development ||
optionalOutput == null) {
// send email if user is not running in dev or interactive mode (show=true)
Message message = new Message();
message.setSender(Config.EMAIL_TO_SEND_UPDATE_ERRORS);
message.setSubject("[devfestnorte-data-error] Updater - Inconsistent data");
message.setTextBody(errorMessage.toString());
MailServiceFactory.getMailService().sendToAdmins(message);
} else {
// dump errors to optionalOutput
optionalOutput.write(errorMessage.toString().getBytes());
}
}
开发者ID:ramonrabello,项目名称:devfestnorte-app,代码行数:27,代码来源:APIUpdater.java
示例3: send
import com.google.appengine.api.mail.MailServiceFactory; //导入依赖的package包/类
public void send(String toAddress, String title, String htmlMessage) {
MailService service = MailServiceFactory.getMailService();
MailService.Message message = new MailService.Message();
message.setSender(fromAddress);
message.setTo(toAddress);
message.setSubject(title);
message.setHtmlBody(htmlMessage);
try {
service.send(message);
LOG.info("message has been sent from " + fromAddress + " to " + toAddress);
} catch (IOException e) {
LOG.warning("Can't send id from " + fromAddress + " to " + toAddress + " about " + title + ": " + e.getMessage());
}
}
开发者ID:cilogi,项目名称:lid,代码行数:15,代码来源:SendEmail.java
示例4: process
import com.google.appengine.api.mail.MailServiceFactory; //导入依赖的package包/类
private void process(HttpServletResponse resp, boolean showOnly) throws IOException {
// everything ok, let's update
StringBuilder summary = new StringBuilder();
JsonObject contents = new JsonObject();
JsonDataSources sources = new VendorDynamicInput().fetchAllDataSources();
for (String entity: sources) {
JsonArray array = new JsonArray();
JsonDataSource source = sources.getSource(entity);
for (JsonObject obj: source) {
array.add(obj);
}
summary.append(entity).append(": ").append(source.size()).append("\n");
contents.add(entity, array);
}
if (showOnly) {
// Show generated contents to the output
resp.setContentType("application/json");
Writer writer = Channels.newWriter(Channels.newChannel(resp.getOutputStream()), "UTF-8");
JsonWriter outputWriter = new JsonWriter(writer);
outputWriter.setIndent(" ");
new Gson().toJson(contents, outputWriter);
outputWriter.flush();
} else {
// Write file to cloud storage
CloudFileManager fileManager = new CloudFileManager();
fileManager.createOrUpdate("__raw_session_data.json", contents, true);
// send email
Message message = new Message();
message.setSender(Config.EMAIL_FROM);
message.setSubject("[iosched-data-update] Manual sync from CMS");
message.setTextBody(
"Hey,\n\n"
+ "(this message is autogenerated)\n"
+ "This is a heads up that "+userService.getCurrentUser().getEmail()+" has just updated the IOSched 2015 data from the Vendor CMS.\n\n"
+ "Here is a brief status of what has been extracted from the Vendor API:\n"
+ summary
+ "\n\n"
+ "If you want to check the most current data that will soon be sync'ed to the IOSched Android app, "
+ "check this link: http://storage.googleapis.com/iosched-updater-dev.appspot.com/__raw_session_data.json\n"
+ "This data will remain unchanged until someone with proper privileges updates it again on https://iosched-updater-dev.appspot.com/cmsupdate\n\n"
+ "Thanks!\n\n"
+ "A robot on behalf of the IOSched team!\n\n"
+ "PS: you are receiving this either because you are an admin of the IOSched project or "
+ "because you are in a hard-coded list of I/O organizers. If you don't want to "
+ "receive it anymore, pay me a beer and ask kindly.");
MailServiceFactory.getMailService().sendToAdmins(message);
resp.sendRedirect("/admin/schedule/updateok.html");
}
}
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:54,代码来源:CMSUpdateServlet.java
示例5: reportDataCheckFailures
import com.google.appengine.api.mail.MailServiceFactory; //导入依赖的package包/类
private void reportDataCheckFailures(CheckResult result, OutputStream optionalOutput) throws IOException {
StringBuilder errorMessage = new StringBuilder();
errorMessage.append(
"\nHey,\n\n"
+ "(this message is autogenerated)\n"
+ "\n** UPDATE: ignore the part of the message below that says the updater is halted. Halting the updating process is not implemented yet. **\n\n"
+ "The IOSched 2014 data updater is halted because of inconsistent data.\n"
+ "Please, check the messages below and fix the sources. "
/*+ "If you are ok with the data "
+ "even in an inconsistent state, you or other app admin will need to force an update by "
+ "clicking on the \"Force update\" button at https://iosched-updater-dev.appspot.com/admin/\n\n"*/
+ "\n\n" + result.failures.size() + " data non-compliances:\n");
for (CheckFailure f: result.failures) {
errorMessage.append(f).append("\n\n");
}
// Log error message to syslog, so that it's available even if the log is truncated.
Logger syslog = Logger.getLogger(APIUpdater.class.getName());
syslog.log(Level.SEVERE, errorMessage.toString());
// Send email with error message to project admins.
if (SystemProperty.environment.value() != SystemProperty.Environment.Value.Development ||
optionalOutput == null) {
// send email if user is not running in dev or interactive mode (show=true)
Message message = new Message();
message.setSender(Config.EMAIL_FROM);
message.setSubject("[iosched-data-error] Updater - Inconsistent data");
String errorMessageStr = errorMessage.toString();
if (errorMessageStr.length() > ADMIN_MESSAGE_SIZE_LIMIT) {
int truncatedChars = errorMessage.length() - ADMIN_MESSAGE_SIZE_LIMIT;
errorMessageStr = errorMessageStr.substring(0, ADMIN_MESSAGE_SIZE_LIMIT);
errorMessageStr +=
"\n\n--- MESSAGE TRUNCATED, " + truncatedChars + " CHARS REMAINING (CHECK LOG) ---";
}
message.setTextBody(errorMessageStr);
MailServiceFactory.getMailService().sendToAdmins(message);
} else {
// dump errors to optionalOutput
optionalOutput.write(errorMessage.toString().getBytes());
}
}
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:43,代码来源:APIUpdater.java
示例6: setUp
import com.google.appengine.api.mail.MailServiceFactory; //导入依赖的package包/类
@Before
public void setUp() {
mailService = MailServiceFactory.getMailService();
clear();
}
开发者ID:GoogleCloudPlatform,项目名称:appengine-tck,代码行数:6,代码来源:MailServiceTest.java
注:本文中的com.google.appengine.api.mail.MailServiceFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论