通过Google应用引擎发送会议邀请邮件 [英] Send meeting invitation mail over Google app engine

查看:280
本文介绍了通过Google应用引擎发送会议邀请邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想发送iCalendar会议邀请。我正在使用Google App引擎,Java。
我设法发送带有iCalendar文件的邮件作为附件,但像Outlook这样的程序不会自动将其识别为会议邀请。



我必须将附件的内容类型设置为:text / calendar; method = REQUEST,但在我看来,GAE不接受?



更新:上面我错了。我实际上发现,我必须使用iCalendar部分直接在内容中发送邮件,而不是附件!所以我的问题是,GAE似乎不接受设置消息本身的内容类型。



有没有人通过使用GAE的邮件成功发送会议邀请iCalendar元素? / p>

更新:



我明白,我必须更具体。其实我想发送iMip消息。 iMip消息不是多部分,其内容类型是文本/日历。在发送会议邀请的情况下,它将是文本/日历;方法=请求。所以我试过这个:

 消息msg = new MimeMessage(session); 
msg.setContent(iCalendarAsString,text / calendar; method = REQUEST);

然后我用Transport.send(..)发送消息;



在GAE的开发服务器的日志中,我们看到内容类型是text / plain。
这就是为什么我说,我认为,GAE不接受设置不同的内容类型。



或者我错了?



更新2



确定,以下是完整的代码:



属性props = new Properties();

  
会话session = Session.getDefaultInstance(道具,null);


try {
消息msg = new MimeMessage(session);

msg.setFrom(new InternetAddress(ical@someapp.appspotmail.com,SomeApp));
msg.addRecipient(Message.RecipientType.TO,
new InternetAddress(me@mydomain.de,Sven Busse));
msg.setSubject(会议邀请!);
msg.setContent(iCalendarAsString,text / calendar; method = REQUEST);

Transport.send(msg);

} catch(AddressException e){
log.warning(e.toString());
e.printStackTrace();
} catch(MessagingException e){
log.warning(e.toString());
e.printStackTrace();
} catch(UnsupportedEncodingException e){
log.warning(e.toString());
e.printStackTrace();
}

所以,我将内容类型设置为text / calendar; method =请求。一旦我发送,这是日志:

  14.09.2011 09:52:59 com.google.appengine.api。 mail.dev.LocalMailService日志
信息:MailService.send
INFO:From:SomeApp< ical@someapp.appspotmail.com>
信息:收件人:Sven Busse< me@mydomain.de>
信息:回复:SomeApp< ical@someapp.appspotmail.com>
信息:主题:会议邀请!
INFO:Body:
INFO:Content-type:text / plain
INFO:数据长度:458

所以,日志看起来不漂亮,但你可以看到,内容类型已经改变为text / plain。



更新3:

 发送到:me@mydomain.de 
收到:10.68.59.7与SMTP id v7cs112540pbq;
Thu,2011年9月15日07:45:55 -0700(PDT)
收到:由10.52.195.44与SMTP id dh12mr1121151vdb.20.1316097954738;
Thu,2011年9月15日07:45:54 -0700(PDT)
返回路径:< 3oQ9yTgoJCgIdqqmngvqpciockn.eqouxgp.dwuugiqqingockn.eqo@2uix4h7xygsz66weerlq.apphosting.bounces.google.com>
收到:从mail-vw0-f69.google.com(mail-vw0-f69.google.com [209.85.212.69])
由mx.google.com与ESMTPS id o9si1579035vcv.136.2011.09.15 .07.45.53
(version = TLSv1 / SSLv3 cipher = OTHER);
Thu,2011年9月15日07:45:53 -0700(PDT)
Received-SPF:pass(google.com:domain of 3oQ9yTgoJCgIdqqmngvqpciockn.eqouxgp.dwuugiqqingockn.eqo@2uix4h7xygsz66weerlq.apphosting.bounces.google .com指定209.85.212.69为允许的发件人)client-ip = 209.85.212.69;
验证结果:mx.google.com; SPF =通(google.com:3oQ9yTgoJCgIdqqmngvqpciockn.eqouxgp.dwuugiqqingockn.eqo@2uix4h7xygsz66weerlq.apphosting.bounces.google.com的域指定209.85.212.69所允许的发送者)smtp.mail=3oQ9yTgoJCgIdqqmngvqpciockn.eqouxgp.dwuugiqqingockn.eqo@2uix4h7xygsz66weerlq.apphosting .bounces.google.com
收到:由vws20与SMTP id 20so3831617vws.4
for< me@mydomain.de> ;;星期四,2011年9月15日07:45:53 -0700(PDT)
MIME版本:1.0
收到:由10.236.187.1与SMTP id x1mr5481998yhm.8.1316097953249; Thu,15
2011年9月07:45:53 -0700(PDT)
回复:SomeApp< ical@someapp.appspotmail.com>
X-Google-Appengine-App-Id:someapp
Message-ID:< 20cf305e2551fe38a104acfbee28@google.com&
日期:星期四,2011年9月15日14:45:53 +0000
主题:会议邀请!
From:SomeApp< ical@someapp.appspotmail.com>
至:Sven Busse< me@mydomain.de>
Content-Type:text / plain;字符集= ISO-8859-1;格式=流动; delsp = yes

开始:VCALENDAR
PRODID: - // Ben Fortuna // iCal4j 1.0 // EN
VERSION:2.0
CALSCALE:GREGORIAN
方法:REQUEST
BEGIN:VEVENT
DTSTAMP:20110915T144552Z
UID:20110915T144552Z-1@someapp.appspotmail.com
摘要:收费projekt\,macht viel spass。
DTSTART; VALUE = DATE:20110919
DTEND; VALUE = DATE:20110926
描述:tolles projekt\,macht viel spass。
ATTENDEE; ROLE = REQ-PARTICIPANT; RSVP = TRUE:mailto:me@mydomain.de
ORGANIZER:mailto:ical@someapp.appspotmail.com
END:VEVENT
END :VCALENDAR


解决方案

也许你应该考虑使用像 http://context.io/



(不是附属!)


i want to send iCalendar meeting invitations. I am using Google App engine, Java. I managed to send a mail with an iCalendar file as an attachment, but programs like Outlook do not automatically recognize it as a meeting invitation.

I figure, i have to set the content-type of the attachment to: "text/calendar; method=REQUEST", but it seems to me, GAE is not accepting this?

Update: I was wrong above. I actually found, that i have to send the mail with the iCalendar part directly in the content, not as an attachment! So my problem is, GAE seems not to accept setting the content-type of the message itself.

Has anyone succesfully send a meeting invitation iCalendar element through mail using GAE?

Update:

I understand, i have to be more specific. In fact, i want to send iMip messages. iMip messages are not multipart, their content-type is "text/calendar". And in the case of sending a meeting invitation, it would be "text/calendar;method=REQUEST". So i tried this:

Message msg = new MimeMessage(session);
msg.setContent(iCalendarAsString, "text/calendar;method=REQUEST");

Then i send the message with Transport.send(..);

In the logs in the development server of GAE i then see, that the content type is "text/plain". that's why i said, i think, GAE is not accepting setting a different content type.

Or am i wrong?

Update 2

OK, here's the complete code:

Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);


try {
    Message msg = new MimeMessage(session);

    msg.setFrom(new InternetAddress("ical@someapp.appspotmail.com", "SomeApp"));
    msg.addRecipient(Message.RecipientType.TO,
            new InternetAddress("me@mydomain.de", "Sven Busse"));
    msg.setSubject("meeting invitation!");
    msg.setContent(iCalendarAsString, "text/calendar;method=REQUEST");

    Transport.send(msg);

} catch (AddressException e) {
    log.warning(e.toString());
    e.printStackTrace();
} catch (MessagingException e) {
    log.warning(e.toString());
    e.printStackTrace();
} catch (UnsupportedEncodingException e) {
    log.warning(e.toString());
    e.printStackTrace();
}

So, i set the content-type to "text/calendar;method=REQUEST". And once i send, this is the logs:

14.09.2011 09:52:59 com.google.appengine.api.mail.dev.LocalMailService log
INFO: MailService.send
INFO:   From: SomeApp <ical@someapp.appspotmail.com>
INFO:   To: Sven Busse <me@mydomain.de>
INFO:   Reply-to: SomeApp <ical@someapp.appspotmail.com>
INFO:   Subject: meeting invitation!
INFO:   Body:
INFO:     Content-type: text/plain
INFO:     Data length: 458

So, the logs don't look pretty, but you can see, the content-type has changed to "text/plain".

Update 3:

Delivered-To: me@mydomain.de
Received: by 10.68.59.7 with SMTP id v7cs112540pbq;
        Thu, 15 Sep 2011 07:45:55 -0700 (PDT)
Received: by 10.52.95.44 with SMTP id dh12mr1121151vdb.20.1316097954738;
        Thu, 15 Sep 2011 07:45:54 -0700 (PDT)
Return-Path: <3oQ9yTgoJCgIdqqmngvqpciockn.eqouxgp.dwuugiqqingockn.eqo@2uix4h7xygsz66weerlq.apphosting.bounces.google.com>
Received: from mail-vw0-f69.google.com (mail-vw0-f69.google.com [209.85.212.69])
        by mx.google.com with ESMTPS id o9si1579035vcv.136.2011.09.15.07.45.53
        (version=TLSv1/SSLv3 cipher=OTHER);
        Thu, 15 Sep 2011 07:45:53 -0700 (PDT)
Received-SPF: pass (google.com: domain of 3oQ9yTgoJCgIdqqmngvqpciockn.eqouxgp.dwuugiqqingockn.eqo@2uix4h7xygsz66weerlq.apphosting.bounces.google.com designates 209.85.212.69 as permitted sender) client-ip=209.85.212.69;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of 3oQ9yTgoJCgIdqqmngvqpciockn.eqouxgp.dwuugiqqingockn.eqo@2uix4h7xygsz66weerlq.apphosting.bounces.google.com designates 209.85.212.69 as permitted sender) smtp.mail=3oQ9yTgoJCgIdqqmngvqpciockn.eqouxgp.dwuugiqqingockn.eqo@2uix4h7xygsz66weerlq.apphosting.bounces.google.com
Received: by vws20 with SMTP id 20so3831617vws.4
        for <me@mydomain.de>; Thu, 15 Sep 2011 07:45:53 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.236.187.1 with SMTP id x1mr5481998yhm.8.1316097953249; Thu, 15
 Sep 2011 07:45:53 -0700 (PDT)
Reply-To: SomeApp <ical@someapp.appspotmail.com>
X-Google-Appengine-App-Id: someapp
Message-ID: <20cf305e2551fe38a104acfbee28@google.com>
Date: Thu, 15 Sep 2011 14:45:53 +0000
Subject: meeting invitation!
From: SomeApp <ical@someapp.appspotmail.com>
To: Sven Busse <me@mydomain.de>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes

BEGIN:VCALENDAR
PRODID:-//Ben Fortuna//iCal4j 1.0//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTAMP:20110915T144552Z
UID:20110915T144552Z-1@someapp.appspotmail.com
SUMMARY:tolles projekt\, macht viel spass.
DTSTART;VALUE=DATE:20110919
DTEND;VALUE=DATE:20110926
DESCRIPTION:tolles projekt\, macht viel spass.
ATTENDEE;ROLE=REQ-PARTICIPANT;RSVP=TRUE:mailto:me@mydomain.de
ORGANIZER:mailto:ical@someapp.appspotmail.com
END:VEVENT
END:VCALENDAR

解决方案

Maybe you should think of using a service like http://context.io/ ?

(not affiliated !)

这篇关于通过Google应用引擎发送会议邀请邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆