facebook

On Click – Send Email SOLVED

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 15 posts - 1 through 15 (of 23 total)
  • Author
    Posts
  • #338407 Reply

    Publio Decio
    Member

    @ octavio

    Good morning,
    I read the help on “MobiOne Widget” I want to know if it is possible to dynamically change the text of the email, and do not define it before.
    Hello
    Alessandro

    #338438

    Hi Publio Decio,

    The Visual Designer’s Send Mail action does not support modification of the msg content. An alternative is to use javascript to construct a mailto: URL – this is basically what the SendMail actiond does. If you are not comfortable with JavaScript coding then you may consider posting your exact requirement to the Getting Help forum and seek volunteer assistance or request professional assistance.

    #338590

    Publio Decio
    Member

    Hi Octavio

    My app is native IOS. if I wanted to format the text of the email in the following way (example: in 3 lines):

    foo
    pluto
    mouse

    I can not format it correctly in the IOS version. I tried to use \ n or the CR & LF but if it works in the test center + outlook does not work on the device (iphone).
    I tried searching but could not find anything that worked.
    Do you have any idea to format text?

    thanks
    Alessandro

    #338597

    Stu Wade
    Member

    I believe that this is a solution to your problem …

    Create a large Text Area widget somewhere in your project
    In the documentReadyHandler set its visibility to hidden
    Prepare your email in the .val property USING HTML so the .val starts < html > without the spaces and ends < /html >
    Do all your formatting using HTML – for my application I forced a mono space font and used the pre tag which gave me full ‘typewriter’ formatting. Depending on exactly what you need to do the required HTML may be very straight forward or downright tricky – so enjoy.
    The final stage is to set up a send email button which picks up the text area as the content field when you click this the native email app steps in and lo and behold you are looking at your formatted text ready to go

    Ps added in edit
    I’m running windows XP on my development machine and outlook really hates this approach so the M1 emulator won’t work but trust me the web app on my iPod works a treat

    #338707

    Publio Decio
    Member

    @stu

    Thank you for your help. but I’m doing something wrong.
    I created this code in the text area:

    ‘<html><body><p>Torneo: <br />del: <br />ore: <br />Match: <br />Superficie: <br />Score: <br /></p><p> Commento partita: </p></body></html>’

    but when I click the button in the email completely ignores the html code
    I used this function

    ‘mailto:’ + email + ‘?subject=’ + subject + ‘&body=’ + encodeURIComponent($(‘#ac-mtcmail-textArea1’).val());
    or
    ‘mailto:’ + email + ‘?subject=’ + subject + ‘&body=’ + $(‘#ac-mtcmail-textArea1’).val();

    thanks again

    #338713

    Stu Wade
    Member

    Seems that it was I that was being unclear, sorry.

    The button I click has its on click action set to ‘Send Email’ and (for my use) I populate the Email […] screen with To: empty, Subject: a constant and Message: ${Report} where Report is the Id of my text area.

    I do not explicitly use the mailto: construct I let M1 handle all those messy details.

    I am not familiar with the <br /> tag in your example – I simply use <br>

    #338780

    Hi Stu,

    Correct me if I’m wrong but my understanding is you are reporting that the SendMail action recognizes and renders <html> markup msg content when performed in an iOS webapp. But from a native app the msg content displays the <html> program text literally rather than render it. If this is the problem then please note that you are just getting lucky in a webapp form of SendMail. This will not work in all iOS versions and is not part of the mailto: spec. Given that we only support text email.

    The sendMail action is implemented differently between webapp and native app on iOS. For webapp we simply invoke a mailto: url and let the OS handle it. In a native app this is not possible and we use the cordova/phonegap mail composer plugin.

    #338790

    Publio Decio
    Member

    Hello Stu & Octavio

    I found this plugin.
    https://github.com/phonegap/phonegap-plugins/tree/master/iPhone/EmailComposer

    I modified cordova.addConstructor as indicated in the post stackoverflow
    (http://stackoverflow.com/questions/10587398/cordova-custom-plugin-structure-wo-callbacks)

    and I built the function for sending the mail, but by executing the program on: IPAD seems to ignore the command.
    I continue to investigate, if you find an alternative solution, post it

    Hello
    Alessandro

    P.S. could be an interesting solution

    #338791

    Stu Wade
    Member

    Thanks both,

    Yes, I too am now in the mire … See my thread ‘Aaaargh’ below.

    Will look at the phonegap stuff you indicate – perhaps I shall find inspiration.

    When the WebApp worked so perfectly – I really thought I was home free – bah!!!

    #338795

    Publio Decio
    Member

    @ Octavio & Stu

    I was testing the function: phoneui.composeEmail = function (subject, body, to, cc, bcc, isHTML)
    (Contained in \ res \ phoneui.js) running in the web application’s okay, while running on my ipad the program crashes.

    the parameters are correct and the body is in html format.

    Do you have any suggestions?
    thanks
    Alessandro

    #338798

    Unknown Author
    Participant
    
    phoneui.composeEmailFromPage($('#m1-PageName'), 'to@email.com', 'Subject', 'Email Text');
    
    #338800

    Publio Decio
    Member

    This function handles the text in html format?, the other in the last parameter is used to identify the format. I used 2.5 version not tested in 2.3

    Thanks

    #338802

    Stu Wade
    Member

    I have now checked the composeEmailFromPage function in phoneui.js – it constructs an email body then explicitly uses a call of composeEmail with the isHTML argument set false – so, unless I’m being extraordinarily thick (quite possible this problem is “doin’ my head in”), it will not handle HTML. Sorry 1tc but keep trying we need all the help we can get.

    #338804

    Publio Decio
    Member

    updated:
    the function works perfectly phoneui.composeEmailFromPage($(‘#m1-PageName’), mailto:’to@email.com‘, ‘Subject’, ‘Email Text’);

    phoneui.composeEmail = function (subject, body, to, cc, bcc, isHTML) function does not work
    both with and ios version 2.5 of MobiOne

    is the problem of MobiOne 2.5 ?

    bye

    #338810

    Stu Wade
    Member

    @Publio

    Does ‘works perfectly’ mean you got html code correctly interpretted? I tried …

    phoneui.composeEmailFromPage($('#m1-Chicago'),'','Ad Hoc Bridge',$('#m1-Chicago-Report').val());

    and got the raw uninterpretted html …

    What am i missing? Am I stupid?

Viewing 15 posts - 1 through 15 (of 23 total)
Reply To: On Click – Send Email SOLVED

You must be logged in to post in the forum log in