473,851 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how can i include image with message send to mail

123 New Member
i have a website let assume it is www.mydomain.co m i create an email in my control panel service@mydomai n.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. }
Aug 20 '09 #1
5 7829
8,658 Recognized Expert Moderator Expert
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
123 New Member
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
6,050 Recognized Expert Expert
Use the elegant SwiftMailer to send an HTML email.
Aug 21 '09 #4
123 New Member
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']);
  9. // multiple recipients
  10. $to  = $mail;
  11. // subject
  12. $subject = 'You have just register with alinke';
  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>';
  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";
  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. }
  51. ?>
Aug 27 '09 #5
1,654 Recognized Expert Top Contributor
Hi simon2x1, you might have to provide the absolute address of the image.
<img src="http://www.yoursite.co m/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

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 one please help. Thanks, mashraf
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 send it, it answers, "The transport failed to connect to server". I suppose that means the SMTP-server. Since I used that SMTP-server several times when I send e-mail, I can't figure out why I
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 MailMessage(); mailMsg.From = from; from = from + from;
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' size='1'>Trinity Systems - Comprar - Private Label Control - " + dt.Day + "/" + dt.Month + "/" + dt.Year + "</font></p>" + "<hr color='#C0C0C0' align='left' size='3'>" + "<br> Nome:"
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 identifies itself as the computer name which is not in domain.com format, triggering spam filter problems). Instead, I want to have my code send through an SMTP server of a company that we pay for mail service. But they require a username and password....
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 part of the email with something else. Looking at the server sent email source, the hacked emails have the following: This is a multi-part message in MIME format. ------=_NextPart_000_0001_01C60610.91D1FFA0 Content-Type: text/plain;...
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 subject" .HtmlBody = "This is the Body" .Send End With
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 mail externally to a internet email site like Gmail the PDF is sent but is corrupted because CDOSYS ends up using binary encoding rather than Base64 encoding when creating the attachment. More information here: Anthonys Code My knowledge of ASP...
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 from, string to, string subject, string body) { string filname = "G:\\Notes\\Sample Project\\Bday\\bh.gif"; MailMessage mail = new MailMessage(from, to, subject, body); mail.Attachments.Add(new...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.