Results 1 to 8 of 8

Thread: send image via email

  1. #1
    Join Date
    Nov 2005

    send image via email

    I made a newsletter script that sends an email using a rich text editor called "FCK Editor".

    This editor allow you to insert an image and send it along with a text and i did insert an image and previewed it and looks fine. But, once i send the email, i get \"\" in the picture place of my email.
    How can i make the picture appear in my email.

    Here is the code:
    PHP Code:
    if (isset($_POST['send_e'])) {
    $email_from =     $_POST["email_from"];
    $email_to     =     $_POST["email_to"];
    $title         =     $_POST["title"];
    $body         =     nl2br($_POST["FCKeditor1"]);
        if (empty(
    $title) || empty($body) || empty($email_to) || empty($email_from)) {
    error_box("All Fields Cannot Be Left Blank");
    //echo "$body";
    $to         $email_to;
    $headers "MIME-Version: 1.0\r\n"
    $headers .= "Content-type: text/html; charset=windows-1256\r\n"
    $headers .= "From: Info <$email_from>\r\n"
    $headers .="Return-Path: $email_from\r\n";
    $headers .="Return-Receipt-To: $email_from\r\n";
    $headers .="X-Mailer: My Smart Newsletter \r\n";
    $headers .="Message-ID: ".rand(00000000,999999999)."-info@yoursite.com\r\n";
    $Send mail($to"$title,$body,"$headers"); 
        if (
    $Send) {
    msg_box("Success","Email Sent Successfully");
    "<meta http-equiv='refresh' content='1;URL=main.php'>";
    } else {
    open_table("Mailing » Send Individual Mails");
        <form method="POST" action="">
                <td valign="top">Email From<br/>
                    <input type="text" name="email_from" size="35" value="info@yourdomain.com">
                <td valign="top">Email To<br/>
                    <input type="text" name="email_to" size="35">
                <td valign="top">Title<br/>
                    <input type="text" name="title" size="35">
                <td valign="top">Body<br>
                        <input type="hidden" id="FCKeditor1" name="FCKeditor1" value="" style="display:none" />
                        <input type="hidden" id="FCKeditor1___Config" value="" style="display:none" />
                        <iframe id="FCKeditor1___Frame" src="fck_en/editor/fckeditor.html?InstanceName=FCKeditor1&amp;Toolbar=Default" width="500%" height="420" frameborder="yes" scrolling="no">
                <td colspan="2" align="center" valign="top">
                    <input type="submit" name="send_e" value="Send" onclick="return confirm('are you sure you want to send this ?');">
                    <input type="reset" name="reset" value="Clear">
    One more question, i tested this code in 2 sites located in different servers. it works fine in one site, and it does not send in the other server although it gives success message but it didn't send an email. I also checked the bulk/junk folder, the email was n't sent at all.
    Any idea ?
    Last edited by themoon; 08-15-2008 at 10:09 AM.

  2. #2
    Join Date
    Mar 2007
    Check the hosts FAQ on sending php mail. Some hosts have a strict policy and have extra functions to use before and after the send mail function.
    --> JavaScript Frameworks like JQuery, Angular, Node <--
    ... and please remember to wrap code with forum BBCode tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

  3. #3
    Join Date
    Nov 2005
    ok, thanks
    what about the problem of not being able to view the image that inserted by the editor. I keep getting something like an escape character like this: \"\"

  4. #4
    Join Date
    Mar 2007
    As I have never sent an image by mail using this method, I couldn't help you BUT... a search of this web forum will give you plenty of threads that do show you how.

    Or if you wait a while, someone may be able to point you to the appropriate help.
    --> JavaScript Frameworks like JQuery, Angular, Node <--
    ... and please remember to wrap code with forum BBCode tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

  5. #5
    Join Date
    Nov 2005
    anyone had experience in inserting an image via this editor ?


  6. #6
    Join Date
    May 2003
    this image you are previewing in the editor...it is on a website already, right? Your not relying on FCKeditor to do the upload for you, right?

    Also, when you view the source of the received email, are you at least seeing the img tag, where the image should be?
    We do precision guesswork

  7. #7
    Join Date
    Nov 2005
    yes, i'm not relying on the editor to upload the image. THe image is already on a webiste. i just put its path.
    And i don't find the image tag in the source code of the received email.
    I'm trying to find whichever possible way to send an email containing an image
    as a greeting card to my list of users.

    I'm not sure if there is a special header to be added in my php code.
    or there might be some configuration in fckeditor that allow you to upload and
    send images via the editor using php.

    Thanks in advance.

  8. #8
    Join Date
    Apr 2007
    firstly ensure the correct use of headers
    PHP Code:
    $message nl2br($message);
    $headers "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "From: mysite<info@mysite.co.uk>\r\n";
    $headers .= "Return-path: mysite<info@mysite.co.uk>\r\n";
    //$headers = "BCC: messagesent@mysite.com\r\n";

    // Send
    $rc mail($email$subject$message$headers); 
    Then in the message area ensure to include the full path src, html and body tags.

    The full 'Basic' code
    PHP Code:
    $message "<html><body background ='http://www.mysite.co.uk/images/grid_medblue.gif'><p><img src='http://www.mysite.co.uk/images/mysite.gif'><br /><br />Hello,</p><p>Have You taken a look at <a href='http://www.mysite.co.uk'>www.mysite.co.uk</a>. Take a look at <a href='http://www.mysite.co.uk/example.php'>www.mysite.co.uk/example.php</a> to see the site in full </p></body></html>";

    $message nl2br($message);
    $headers "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "From: mysite<info@mysite.co.uk>\r\n";
    $headers .= "Return-path: mysite<info@mysite.co.uk>\r\n";
    //$headers = "BCC: messagesent@mysite.com\r\n";

    // Send
    $rc mail($email$subject$message$headers);

     if (
    $rc) {
    // what to do if sent 
    } else {
    failed etcerror reporting..................

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.10372 seconds
  • Memory Usage 2,948KB
  • Queries Executed 13 (?)
More Information
Template Usage (33):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (8)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (70):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates