Jump to content



Photo
- - - - -

embed image in email ( all customers )


This topic has been archived. This means that you cannot reply to this topic.
18 replies to this topic

#1   paulieGB

paulieGB
  • Members
  • 232 posts

Posted 12 September 2009 - 15:12

Hello,

My question is how do i embed an image inan email to send to all customers ?

Thanks for any help,
Paul

#2   jackanderson

jackanderson
  • Members
  • 90 posts

Posted 12 September 2009 - 15:29

Do you mean in Order emails? or in Newsletter?
Converge

#3   paulieGB

paulieGB
  • Members
  • 232 posts

Posted 12 September 2009 - 15:46

Theres an option when you send an email, you can send to ' all customers'

Thats what i want to do, send an email to all my customers promoting new products on the site with pictures and a heading.

Thanks,
Paul

#4   jackanderson

jackanderson
  • Members
  • 90 posts

Posted 12 September 2009 - 15:53

That would be the Newsletter..

Upload the image to your webserver..

When sending the Newsletter, make sure HTML is on, and then embed the image using full path of the image..

ex: <img src="http://www.mydomain....er/image01.jpg" border="0" />

That's it.. Try sending to a single customer (usually yourself) first to see how it looks before you take the plunge and send to all..

Adding FCKEditor (or any other WYSIWYG editor) to your Product and Newsletter boxes is highly recommended..

Good Luck!

Converge

#5   paulieGB

paulieGB
  • Members
  • 232 posts

Posted 12 September 2009 - 16:03

Hi,

Thanks for the help,

The image is my header and i typed in the code you said with my URL for the image, the URL ( path ) is right but the email just shows the code and no image.

How do i make sure HTML is on ?
Is that why it is not working ?

Paul

#6   jackanderson

jackanderson
  • Members
  • 90 posts

Posted 12 September 2009 - 16:14



Paul,

In your Administration section, navigate to..

Admin » Email Options » Use MIME HTML When Sending Emails

Set to "true"


This will ensure HTML Emails..

Converge

#7   paulieGB

paulieGB
  • Members
  • 232 posts

Posted 12 September 2009 - 16:16

I found the HTML in configuration - email options in admin and switched ON.

The image is still not being sent through email, the path is correct. here =

<img src="https://www.thecardm...ate/header.jpg" border="0" />

Any help please ?
Thanks,
Paul

#8   medved

medved
  • Members
  • 275 posts

Posted 12 September 2009 - 18:01

I found the HTML in configuration - email options in admin and switched ON.

The image is still not being sent through email, the path is correct. here =

<img src="https://www.thecardm...ate/header.jpg" border="0" />

Any help please ?
Thanks,
Paul


Try to remove "s" from htpps in the code.

#9   lindsayanng

lindsayanng
  • Members
  • 4,258 posts

Posted 12 September 2009 - 18:28

yes.. removing the https could be the problem, however i would think that if that was the problem instead of seeing code you would see a box with a red X (it would be LOOKING for a picture but not finding it)

Can you post your email configurations exactly as you see them?

also, i think he is using the SEND EMAIL and not the newsletter.. the SEND EMAIL option does have a SEND TO ALL option

Edited by lindsayanng, 12 September 2009 - 18:30.

A great place for newbies to start
Road Map to oscommerce File Structure
DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

Proud Memeber of the CODE BREAKERS CLUB!!

#10   paulieGB

paulieGB
  • Members
  • 232 posts

Posted 12 September 2009 - 18:49

hello,

I tryed removing the 's' , no help.
the same as before.

Here is my email config -

Title Value Action
E-Mail Transport Method smtp
E-Mail Linefeeds CRLF
Use MIME HTML When Sending Emails true
Verify E-Mail Addresses Through DNS false
Send E-Mails true


And yes i am using the 'send email' and NOT 'newsletter'
I want to select 'send to all', so every customer gets an email from me.

Thanks,
Paul

#11   Xpajun

Xpajun
  • Members
  • 1,306 posts

Posted 12 September 2009 - 19:31

go half a dozen posts down on this page and you would find this

#12   paulieGB

paulieGB
  • Members
  • 232 posts

Posted 12 September 2009 - 19:58

Hi,

It says its a fix for the newsletter function ?

#13   medved

medved
  • Members
  • 275 posts

Posted 13 September 2009 - 02:31

I tested your code image in my store and it works without the "s"

But i do have modifications made to the original osC code in mail.php

If you want send me your mail.php by e-mail, i can check it out.

Edited by medved, 13 September 2009 - 02:40.


#14   paulieGB

paulieGB
  • Members
  • 232 posts

Posted 13 September 2009 - 09:00

Hi,

Here is my mail.php in admin -



require('includes/application_top.php');

$action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

if ( ($action == 'send_email_to_user') && isset($HTTP_POST_VARS['customers_email_address']) && !isset($HTTP_POST_VARS['back_x']) ) {
switch ($HTTP_POST_VARS['customers_email_address']) {
case '***':
$mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS);
$mail_sent_to = TEXT_ALL_CUSTOMERS;
break;
case '**D':
$mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");
$mail_sent_to = TEXT_NEWSLETTER_CUSTOMERS;
break;
default:
$customers_email_address = tep_db_prepare_input($HTTP_POST_VARS['customers_email_address']);

$mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($customers_email_address) . "'");
$mail_sent_to = $HTTP_POST_VARS['customers_email_address'];
break;
}

$from = tep_db_prepare_input($HTTP_POST_VARS['from']);
$subject = tep_db_prepare_input($HTTP_POST_VARS['subject']);
$message = tep_db_prepare_input($HTTP_POST_VARS['message']);

//Let's build a message object using the email class
$mimemessage = new email(array('X-Mailer: osCommerce'));
// add the message to the object
$mimemessage->add_text($message);
$mimemessage->build_message();
while ($mail = tep_db_fetch_array($mail_query)) {
$mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', $from, $subject);
}

tep_redirect(tep_href_link(FILENAME_MAIL, 'mail_sent_to=' . urlencode($mail_sent_to)));
}

if ( ($action == 'preview') && !isset($HTTP_POST_VARS['customers_email_address']) ) {
$messageStack->add(ERROR_NO_CUSTOMER_SELECTED, 'error');
}

if (isset($HTTP_GET_VARS['mail_sent_to'])) {
$messageStack->add(sprintf(NOTICE_EMAIL_SENT_TO, $HTTP_GET_VARS['mail_sent_to']), 'success');
}
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
<tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
if ( ($action == 'preview') && isset($HTTP_POST_VARS['customers_email_address']) ) {
switch ($HTTP_POST_VARS['customers_email_address']) {
case '***':
$mail_sent_to = TEXT_ALL_CUSTOMERS;
break;
case '**D':
$mail_sent_to = TEXT_NEWSLETTER_CUSTOMERS;
break;
default:
$mail_sent_to = $HTTP_POST_VARS['customers_email_address'];
break;
}
?>
<tr><?php echo tep_draw_form('mail', FILENAME_MAIL, 'action=send_email_to_user'); ?>
<td><table border="0" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td class="smallText"><b><?php echo TEXT_CUSTOMER; ?></b><br><?php echo $mail_sent_to; ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td class="smallText"><b><?php echo TEXT_FROM; ?></b><br><?php echo htmlspecialchars(stripslashes($HTTP_POST_VARS['from'])); ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td class="smallText"><b><?php echo TEXT_SUBJECT; ?></b><br><?php echo htmlspecialchars(stripslashes($HTTP_POST_VARS['subject'])); ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td class="smallText"><b><?php echo TEXT_MESSAGE; ?></b><br><?php echo nl2br(htmlspecialchars(stripslashes($HTTP_POST_VARS['message']))); ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td>
<?php
/* Re-Post all POST'ed variables */
reset($HTTP_POST_VARS);
while (list($key, $value) = each($HTTP_POST_VARS)) {
if (!is_array($HTTP_POST_VARS[$key])) {
echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value)));
}
}
?>
<table border="0" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><?php echo tep_image_submit('button_back.gif', IMAGE_BACK, 'name="back"'); ?></td>
<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_MAIL) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a> ' . tep_image_submit('button_send_mail.gif', IMAGE_SEND_EMAIL); ?></td>
</tr>
</table></td>
</tr>
</table></td>
</form></tr>
<?php
} else {
?>
<tr><?php echo tep_draw_form('mail', FILENAME_MAIL, 'action=preview'); ?>
<td><table border="0" cellpadding="0" cellspacing="2">
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<?php
$customers = array();
$customers[] = array('id' => '', 'text' => TEXT_SELECT_CUSTOMER);
$customers[] = array('id' => '***', 'text' => TEXT_ALL_CUSTOMERS);
$customers[] = array('id' => '**D', 'text' => TEXT_NEWSLETTER_CUSTOMERS);
$mail_query = tep_db_query("select customers_email_address, customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " order by customers_lastname");
while($customers_values = tep_db_fetch_array($mail_query)) {
$customers[] = array('id' => $customers_values['customers_email_address'],
'text' => $customers_values['customers_lastname'] . ', ' . $customers_values['customers_firstname'] . ' (' . $customers_values['customers_email_address'] . ')');
}
?>
<tr>
<td class="main"><?php echo TEXT_CUSTOMER; ?></td>
<td><?php echo tep_draw_pull_down_menu('customers_email_address', $customers, (isset($HTTP_GET_VARS['customer']) ? $HTTP_GET_VARS['customer'] : ''));?></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td class="main"><?php echo TEXT_FROM; ?></td>
<td><?php echo tep_draw_input_field('from', EMAIL_FROM); ?></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td class="main"><?php echo TEXT_SUBJECT; ?></td>
<td><?php echo tep_draw_input_field('subject'); ?></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td valign="top" class="main"><?php echo TEXT_MESSAGE; ?></td>
<td><?php echo tep_draw_textarea_field('message', 'soft', '60', '15'); ?></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td colspan="2" align="right"><?php echo tep_image_submit('button_send_mail.gif', IMAGE_SEND_EMAIL); ?></td>
</tr>
</table></td>
</form></tr>
<?php
}
?>
<!-- body_text_eof //-->
</table></td>
</tr>
</table></td>
</tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Thanks,
Paul

Edited by paulieGB, 13 September 2009 - 09:01.


#15   medved

medved
  • Members
  • 275 posts

Posted 13 September 2009 - 17:07

OK so backup and try this:

Replace this:
$from = tep_db_prepare_input($HTTP_POST_VARS['from']);
	$subject = tep_db_prepare_input($HTTP_POST_VARS['subject']);
	$message = tep_db_prepare_input($HTTP_POST_VARS['message']);
	//Let's build a message object using the email class
	$mimemessage = new email(array('X-Mailer: osCommerce'));
	// add the message to the object
	$mimemessage->add_text($message);

With this:
$from = tep_db_prepare_input($HTTP_POST_VARS['from']);
	$subject = tep_db_prepare_input($HTTP_POST_VARS['subject']);
	$message = tep_db_prepare_input($HTTP_POST_VARS['message']);
	//Let's build a message object using the email class
	$mimemessage = new email(array('X-Mailer: osCommerce'));

	if (EMAIL_USE_HTML == 'true') {
	  $mimemessage->add_html($message);
	} else {
	  $mimemessage->add_text($message);
	}
	// add the message to the object
	//$mimemessage->add_text($message);

Replace this:
<tr>
				<td class="smallText"><b><?php echo TEXT_SUBJECT; ?></b><br><?php echo htmlspecialchars(stripslashes($HTTP_POST_VARS['subject'])); ?></td>
			  </tr>
			  <tr>
				<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
			  </tr>
			  <tr>
				<td class="smallText"><b><?php echo TEXT_MESSAGE; ?></b><br><?php echo nl2br(htmlspecialchars(stripslashes($HTTP_POST_VARS['message']))); ?></td>
			  </tr>
			  <tr>
				<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
			  </tr>
			  <tr>
				<td>
<?php
/* Re-Post all POST'ed variables */

With this:
<tr>
				<td class="smallText"><b><?php echo TEXT_SUBJECT; ?></b><br><?php echo htmlspecialchars(stripslashes($HTTP_POST_VARS['subject'])); ?></td>
			  </tr>
			  <tr>
				<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
			  </tr>
			  <tr>
<?php
/*
				<td class="smallText"><b><?php echo TEXT_MESSAGE; ?></b><br><?php echo nl2br(htmlspecialchars(stripslashes($HTTP_POST_VARS['message']))); ?></td>
*/
?>
				<td class="smallText"><b><?php echo TEXT_MESSAGE; ?></b><br><?php echo nl2br(stripslashes($HTTP_POST_VARS['message'])); ?></td>
			  </tr>
			  <tr>
				<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
			  </tr>
			  <tr>
				<td>
<?php
/* Re-Post all POST'ed variables */


#16   paulieGB

paulieGB
  • Members
  • 232 posts

Posted 13 September 2009 - 17:39

Hello,

I made the changes,
There is a difference,
when i put the code in the email and press send it takes me onto the preview page , where i can see the image /smile.gif' class='bbc_emoticon' alt=':)' />
Before i could onlt see text,
When i sent the message to myself, NO image was on the email just a square with a red X in it ?

Thanks for the help,
Paul

#17   lindsayanng

lindsayanng
  • Members
  • 4,258 posts

Posted 13 September 2009 - 17:46

a square with a red X means that your email is not showing you the image, but the image is there.. Can you right click (or control click on a mac) and choose SHOW IMAGE.. does it show up then?? Is there a link in your email at thetop that says SHOW IMAGES?? Lots of email clients kill images unless you choose specifically to show them
A great place for newbies to start
Road Map to oscommerce File Structure
DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

Proud Memeber of the CODE BREAKERS CLUB!!

#18   paulieGB

paulieGB
  • Members
  • 232 posts

Posted 13 September 2009 - 18:39

Yep that was it,
Thanks

Special thanks to Juraj

It all works fine now /smile.gif' class='bbc_emoticon' alt=':)' />

Paul

#19   medved

medved
  • Members
  • 275 posts

Posted 10 October 2009 - 19:17

You're welcome. I'm glad i could help.