473,323 Members | 1,589 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 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 7795
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.