2

jQuery Mobile を使用して Phone Gap に iPhone アプリケーションを実装しました。

私のアプリの一部として、ボタン「MAIL」をクリックしてメールを送信する必要があります

そのために私は追加しました EmailComposer plug in.

www フォルダーに EmailComposer.js を追加し、

アプリケーションの Resources フォルダーに EmailComposer.H および .M ファイルを追加しました。

次のようにコードを実装しました

<script type="text/javascript" src="EmailComposer.js"></script>
<script type="text/javascript" charset="utf-8"> 

      function SendEmail() { 

           alert('XXXXX');

        window.plugins.emailComposer.showEmailComposer("SubjectXXX","PlainTextBody---", 
                                 "recipientName,recipientName", "ccRecipient", "bccRecipient",false); 
        } 
  </script> 



<a href="#" onclick="SendEmail(); return false;"  data-icon="arrow-r" data-iconpos="left" class="ui-btn-left" >Send</a>

メール コンポーザ ビューには、すべて正常に表示されます。

このメールにファイルを添付する必要があります ファイルの添付方法

誰でも私を導くことができますか

事前に対応します。

4

1 に答える 1

0

私はこのようにしました:

var attachPath; 
                var attachFile= new Array();
                    window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSystem) {
                    fileSystem.root.getDirectory("MyAppFolder", {
                        create: true
                    }, 
        function(directory) {
            console.log("Final 63" + directory.fullPath);
            attachPaths = directory.fullPath;
            var attachPath=attachPaths.slice(7,attachPaths.length);
            var directoryReader = directory.createReader();
            directoryReader.readEntries(function(entries) {
                var i;
                for (i=0; i<entries.length; i++) {
                    console.log(entries[i].name);
attachFile[i] =attachPath + "/" + entries[i].name;
                            }
                            console.log(attachFile);
                        }, 
                        function (error) {
                            alert(error.code);
                        });

                    });
                }, function(error) {
                    alert("can't even get the file system: " + error.code);
                });

attachFile を mailcomposer に渡します。

window.plugins.emailComposer.showEmailComposerWithCallback(null,
                    "Get an Estimate",
                     "Body",
                ["mail_id"],
                    [],
                    [],
                    true,
                    attachFile
                    );

これがお役に立てば幸いです!!!!!

于 2013-10-08T09:13:25.267 に答える