472,971 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,971 software developers and data experts.

how can i include image with message send to mail

123 100+
i have a website let assume it is www.mydomain.com i create an email in my control panel service@mydomain.com,am i to put the stmp configuration in my code below if so, why and where will i include it secondly in the message it want to include an image with the message so the receiver will so the message and the image(company logo) how can i do that.

Expand|Select|Wrap|Line Numbers
  1. $to = "Joe Doe <joe.doe@domain.com>";
  2. $from = "Paul Fred <service@mydomain.com>";
  3. $subject = "Happy Birthday!";
  4. $body =<<< END
  5. Hey Joe,
  6. Just wanted to wish you a happy 30th! Have a good one!
  7. Paul
  8. END;
  9. // send mail
  10. if (mail($to, $subject, $body, "From: $from")) {
  11. echo "Message successfully delivered to mail agent";
  12. } else {
  13. echo "Message could not be delivered to mail agent";
  14. }
  15.  
  16.  
Aug 20 '09 #1
5 7780
Dormilich
8,658 Expert Mod 8TB
2 options (maybe more ;))

make a html email including the image

make a multipart message, depending on the email User Agent the picture may be shown along with the text.
Aug 20 '09 #2
simon2x1
123 100+
Sorry the options you gave to me i do not no how to do any that is why i ask the question.
Aug 21 '09 #3
Markus
6,050 Expert 4TB
Use the elegant SwiftMailer to send an HTML email.
Aug 21 '09 #4
simon2x1
123 100+
the code below is for mail an i send an html email it work but the image i include did not display how can i make the image display

Expand|Select|Wrap|Line Numbers
  1.  <?php
  2.         if (isset($_POST['submit'])){
  3.             if(empty($_POST['name']) OR empty($_POST['email'])){
  4.             echo '<font color="#FF0000" size="2">You haven\'t filled in all the fields.</font>';
  5.             }else{
  6.         $name = ($_POST['name']);
  7.         $mail = ($_POST['email']);
  8.  
  9. // multiple recipients
  10. $to  = $mail;
  11. // subject
  12. $subject = 'You have just register with alinke';
  13.  
  14.                 // message
  15.                 $message = '<html>
  16.                 <head>
  17.                   <title>Alinke</title>
  18.                 </head>
  19.                 <body>
  20.                   <table>
  21.                     <tr>
  22.                 <th colspan="4"><img src="Alinke_files/logo.jpg" align="left"/></th>
  23.                 </tr>
  24.                 <tr>
  25.                   <th colspan="4" align="left">
  26.                    Dear $name<br>
  27.                       this is to remeder you that you have just register<br>
  28.                       with alinke you can now post your company information<br>
  29.                       logo and url.<br>
  30.                       to change your password click link below<br>
  31.                       http://www.alinke.com/test.php
  32.                  </th>
  33.                 </tr>
  34.               </table>
  35.                 </body>
  36.                 </html>';
  37.  
  38.             // To send HTML mail, the Content-type header must be set
  39.             $headers  = 'MIME-Version: 1.0' . "\r\n";
  40.             $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  41.  
  42.             // Additional headers
  43.             $headers .= 'From: Alinke <service@alinke.com>' . "\r\n";
  44.             // Mail it
  45.             mail($to, $subject, $message, $headers);
  46.             echo "Your Password Has Been Sent To Your Email Address.";
  47.         }
  48. }
  49.  
  50.  
  51. ?>
  52.  
Aug 27 '09 #5
hsriat
1,654 Expert 1GB
Hi simon2x1, you might have to provide the absolute address of the image.
<img src="http://www.yoursite.com/yourimage.png" alt="" />

And I still recommend you use SwiftMail or PHPMailer which are better than the mail() function of PHP.
Aug 31 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: mashraf | last post by:
Hi, I am trying to send Mail from VB.net app but I can not do it. Even I can not do this = Imports system.mail, the mail option is not available. I also have to do more then one atachements. Some...
0
by: Henrik Bergman | last post by:
Hi all As I subscribe MSDN I got an USB-memory with Microsoft eLearing library. I found an exampell how to send SMTP e-mail using CDO.Message object and CDO.Configuration. But when I try to...
6
by: erdem kemer | last post by:
i cant send mail to yahoo mail or hotmail while i can send my other mail accounts (pop3) is it becouse yahoo and hotmail is web-based mail here is the code MailMessage mailMsg = new...
6
by: Retf | last post by:
Hi All, I need send e-mail through the form. I tried this: --------------------------------------------------- DateTime dt = DateTime.Now; String sMsg = "<p><font face='Verdana'...
3
by: RN | last post by:
I am tired of sending mail from the built-in SMTP service for so many reasons (errors are nondescriptive in the event log, it doesn't let me control which IP address it sends from, and it...
0
by: nauticalmac | last post by:
I'm using CDO to send mail to the site owner from ASP pages with forms. Recently one of my forms is occasionally sending email with what seems to be an insertion which is replacing the plain text...
6
by: AbraAbraCadabra | last post by:
Here is the code I have been using to send mail... Set objCDO = Server.CreateObject("CDO.Message") With objCDO .To = strTo .From = "markus@domain.com" .Subject = "This is the...
1
by: maxxxxel | last post by:
Hi Can anyone help me with some asp code , I changed the code to use CDO.message instead of the old cdont.sys to send mail from a ASP webpage which works fine. Our problem is that when we send...
1
pbala
by: pbala | last post by:
How to insert a image in message body and send it to Outlook express using SMTP? I used this code to attach a image file, i want to Embed the images in message.. public void SendMail(string...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.