Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8234993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:39:25+00:00 2026-06-07T18:39:25+00:00

Ok, so this one is a bit strange…. I have an HTML page in

  • 0

Ok, so this one is a bit strange….

I have an HTML page in Safari which I want to send as an email. If I go the FILE menu and select “Mail Contents of this Page”, it transfers as expected and looks correct.

However, if I use Scripting Bridge add recipients to the outgoing message, it adds the following code to the top of the message content area for EACH recipient added. In one example, with 24 recipients added, the resulting email contains 24 sequential repeats of the following code:

<div style=3D"font-family: = Helvetica; font-size: 12px; color: black; text-align: left;">
<br =class=3D"webkit-block-placeholder"></div>

which because of the way the div tag is rendered, creates 24 line breaks at the beginning of the email so that my HTML begins further down the page.

Anyone know why this code is getting inserted?

Here is the code I’m using for Scripting Bridge:

SafariDocument *safariDoc = [[[[safari classForScriptingClass:@"document"] alloc]
initWithProperties:[NSDictionary dictionaryWithObject:@"//private/var/tmp/mail.html" forKey: @"URL"]] autorelease];
    [[safari documents] addObject:safariDoc];

SafariWindow *safariWindow = [[safari windows] objectAtIndex:0];
        [safariWindow emailContentsOf:safariWindow.currentTab];
        mailMessage = [[[mail outgoingMessages] objectAtIndex:0] autorelease];

Here is the code I use to add recipients:

MailToRecipient *recipient = [[[[mail classForScriptingClass:@"to recipient"] alloc] 
                                   initWithProperties:[NSDictionary dictionaryWithObjectsAndKeys:
                                                       [preferencesData bandName], @"name",
                                                       [preferencesData bandEmail], @"address",
                                                       nil]] autorelease];
    [[mailMessage toRecipients] addObject:recipient];

* EDIT *

I have found a work around for the problem, but I would still be interested in knowing WHY this code is getting inserted into the body when I add a recipient… The work around is as follows: I inserted the following into the CSS section of my HTML template…

div {
display:none;
}

Thus, the display ignores all of the div tags in the html template. I still have 24 copies of the above code, but they are essentially ignored which solves my visual layout problem.

If anyone has a better solution, please let me know!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T18:39:27+00:00Added an answer on June 7, 2026 at 6:39 pm

    It seems that Apple does not allow you to access outgoing mail messages which you do not “own” or have created from within your program.

    In the code above, I was trying to work around Apple’s limitation of not letting you set your outgoing email to HTML (something else they don’t like you to do) by having Safari “email contents of web page”, thereby creating a new outgoing mail message in Apple Mail.

    I then was attempting to take control of that message by assigning a reference to a variable as follows:

    mailMessage = [[[mail outgoingMessages] objectAtIndex:0] autorelease];
    

    A bit of research revealed that mailMessage was showing as “nil” even though the following code:

    [[mail outgoingMessages] count];
    

    was returning the correct value of 1.

    So in theory, I shouldn’t be able to add recipients to the HTML email created by Safari at all.

    Why it works sometimes and doesn’t work other times is beyond me. But when it does work, it also adds formatting tags into the body of the code as well. I suspect it’s just a bug that hasn’t been caught since it shouldn’t be working at all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This one may be a bit strange. I have a solution in Visual Studio
Bit of a strange one this. Please forgive the semi-pseudo code below. I have
This a bit of strange one.... We have an internal web app that runs
Bit of a backstory to this one... I have an ASP.NET Login App on
I think this one is silly question, but it was a bit strange for
This is a bit of a strange one but I've just seen something on
I know this is bit of a strange one but if anyone had any
Bit of a strange question. I have a website which has some pages in
I realize this one is a bit strange, so I'll explain. For a simple
I have a bit of javascript that I have used successfully on one page,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.