Jump to content
UBot Underground

Replacing parts of page DOM for Gmail Email Creation


Recommended Posts

Hey, just wanted to see if this was possible. 

 

Can we replace part of the DOM in an HTML page on the fly (i.e. while it is loaded)? 

 

I am looking to generate Gmail Emails (from drafts) and am having a lot of trouble keeping the format of certain text (bold, italics, URL links, etc.).  Copy and Paste is just buggy and generating everything with a $type text() (along with clicking/unclicking bold, italic, link button, etc.) just seems like an exceptional waist of time.  This does not go into the fact that I would like these Emails to be up-datable by someone else other than me later on (i.e. they don't have uBot).

 

Anyway, searching on http://webapps.stackexchange.com/questions/3554/how-to-paste-raw-html-into-an-email-in-gmail , I ran into an interesting solution whereby you can replace part of the current text (in HTML/CSS format) and have it render entire lines of formatted text.  Testing this theory in Firefox and clicking the close/save draft button (the "X") confirms that this then saves the updated form of the Email.  I am thinking there is no way to directly replace part of the text on the fly, but don't know which of the following would be good alternatives...

 

1) saving the document text() to a new variable and replacing the old (dummy text) form the Email with new formatted HTML text and then rendering this in a load html() (to click the save button later on), but this does not work.

2) combining the idea above with a <Base HREF="https://mail.google.com/> (and accompanying <head> tags, etc.) to the beginning of the variable above, and then re-rendering (used to be one of my favorite ways of re-rendering a page before uBot a long time ago)

3) replace the whole idea above with a POST/GET command.  However, I am WOEFULLY inadequate when it comes to understanding these.  While I see a lot of potential for dealing with pages directly and circumventing the front end HTML in a lot of cases, it is something that I lack a lot of knowledge in.

 

Some interesting things I found out as well...

 

  • Since the new Gmail uses a 'pop-up' window on top of your current folder/activity, etc, you can add it to the URL as an attribute (e.g. https://mail.google.com/mail/u/0/#inbox can have ?compose=new added to it, to load the inbox page along with a new 'compose' window.)
  • Once you have waited a few seconds after updating the new email, you will receive an ID tag (of some type).  In the example above, I got one similar to ?compose=1446f2649e84b240 .  I can then reference this later on (after refreshing the page, etc.) to go back and work on the Email in the bot.

 

If I am being block headed and there is an easier way to accomplish the task altogether, I am all ears.

 

Thanks in advance.

 

 

Link to post
Share on other sites

UPDATE:  Just found this link which at least gives information on how to construct an Email with the subject, to, bcc, and body areas (

http://stackoverflow.com/questions/6548570/url-to-compose-a-message-in-gmail-with-full-gmail-interface-and-specified-to-b )

.  Now all I need to figure out is how to post HTML/formatted text w/o messing up the URL.  I tried using HTML codes (http://www.ascii.cl/htmlcodes.htm) , but that did not work

 

 

If you have a Gmail account and are logged in, try clicking this...

https://mail.google.com/mail/?view=cm&fs=1&to=someone@example.com&su=SUBJECT&body=BODY&bcc=someone.else@example.com

 

So my updated question:

"Is there a way to transfer the HTML code to the Email?"  Also, "Should I seriously be considering the use of a POST command at this point?"  I haven't even begun to test the HTTP Post() from Aymen ( http://www.ubotstudio.com/forum/index.php?/topic/12837-sell-http-post-plugin-crazy-bonuses-inside/ ) and while I plan to buy it in the future, I am a little short on cash right now.

Link to post
Share on other sites

Thanks bestmacros and Traffik Cop,

 

I tried the basic connection with my private Gmail account using the wizard (UBot 5) and it fails to even connect.  The other issue is that the Gmail account I am trying to send Emails from is a my company's Google account (bought for us).  Even the server is different (i.e. m.google.com instead of smtp.google.com).  I have had trouble connecting to it on my Android Phone device due to the policies set on the server side.  I ended up having to root my phone and install  customized apps just to get it working the way I wanted.

 

Anyway, this is a long way of saying that, while I'll give the Email Commands/Functions in UBot a try again, it may ultimately not be productive.

 

On a side note though, thanks especially for the JQuery reference. Didn't even know that it existed.  It looks promising.  Not just for this project, but for many others!

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...