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. -
$to = "Joe Doe <joe.doe@domain.com>";
-
$from = "Paul Fred <service@mydomain.com>";
-
$subject = "Happy Birthday!";
-
$body =<<< END
-
Hey Joe,
-
Just wanted to wish you a happy 30th! Have a good one!
-
Paul
-
END;
-
// send mail
-
if (mail($to, $subject, $body, "From: $from")) {
-
echo "Message successfully delivered to mail agent";
-
} else {
-
echo "Message could not be delivered to mail agent";
-
}
-
-
5 7816 Dormilich 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.
Sorry the options you gave to me i do not no how to do any that is why i ask the question.
Markus 6,050
Recognized Expert Expert
Use the elegant SwiftMailer to send an HTML email.
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 -
<?php
-
if (isset($_POST['submit'])){
-
if(empty($_POST['name']) OR empty($_POST['email'])){
-
echo '<font color="#FF0000" size="2">You haven\'t filled in all the fields.</font>';
-
}else{
-
$name = ($_POST['name']);
-
$mail = ($_POST['email']);
-
-
// multiple recipients
-
$to = $mail;
-
// subject
-
$subject = 'You have just register with alinke';
-
-
// message
-
$message = '<html>
-
<head>
-
<title>Alinke</title>
-
</head>
-
<body>
-
<table>
-
<tr>
-
<th colspan="4"><img src="Alinke_files/logo.jpg" align="left"/></th>
-
</tr>
-
<tr>
-
<th colspan="4" align="left">
-
Dear $name<br>
-
this is to remeder you that you have just register<br>
-
with alinke you can now post your company information<br>
-
logo and url.<br>
-
to change your password click link below<br>
-
http://www.alinke.com/test.php
-
</th>
-
</tr>
-
</table>
-
</body>
-
</html>';
-
-
// To send HTML mail, the Content-type header must be set
-
$headers = 'MIME-Version: 1.0' . "\r\n";
-
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
-
-
// Additional headers
-
$headers .= 'From: Alinke <service@alinke.com>' . "\r\n";
-
// Mail it
-
mail($to, $subject, $message, $headers);
-
echo "Your Password Has Been Sent To Your Email Address.";
-
}
-
}
-
-
-
?>
-
hsriat 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.
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: 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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |