Hello,
I know there is lots of information out there and I've taken a look, but
I want to learn how to do this myself. And I'm a beginner here and some
of it I don't understand (so no flames, RTFM or GFGI please ;)
Here's my function:
function send_mail($to_n ame, $to_email, $from_name, $from_email,
$subject, $message)
{
$thedate = date("r", time());
$headers = "X-Mailer: PHPMailProgram/1.0\n";
$headers .= "From: \"".$from_name. "\" <".$from_email. ">\n";
$headers .= "Date: $thedate\n";
$headers .= "Content-Type: text/plain\n\n";
$from = "\".$from_name. "\" <".$from_email. ">";
return mail( $from, $subject, $message, $headers);
}
My problem is that it will never arrive with the "Name" <email address>,
and I can only make it work using email addresses without the names or
the angle brackets around the email addresses. Once I tried printing the
headers and the quotes and angle brackets turned up, but no names or
email addresses. And once an email arrived but with nothing but angle
brackets! (I wonder how that happened? The SMTP server must have
stripped things out perhaps?)
Thanks for your time in helping me with this,
Spartacus 2 1673
On Jun 13, 7:06 am, Spartacus <nos...@nowhere .comwrote:
Hello,
I know there is lots of information out there and I've taken a look, but
I want to learn how to do this myself. And I'm a beginner here and some
of it I don't understand (so no flames, RTFM or GFGI please ;)
Here's my function:
function send_mail($to_n ame, $to_email, $from_name, $from_email,
$subject, $message)
{
$thedate = date("r", time());
$headers = "X-Mailer: PHPMailProgram/1.0\n";
$headers .= "From: \"".$from_name. "\" <".$from_email. ">\n";
$headers .= "Date: $thedate\n";
$headers .= "Content-Type: text/plain\n\n";
$from = "\".$from_name. "\" <".$from_email. ">";
return mail( $from, $subject, $message, $headers);
}
My problem is that it will never arrive with the "Name" <email address>,
and I can only make it work using email addresses without the names or
the angle brackets around the email addresses. Once I tried printing the
headers and the quotes and angle brackets turned up, but no names or
email addresses. And once an email arrived but with nothing but angle
brackets! (I wonder how that happened? The SMTP server must have
stripped things out perhaps?)
Thanks for your time in helping me with this,
Spartacus
First, headers need to be separated by "\r\n", not just "\n". Try
that and see if it works any better.
ZeldorBlat wrote:
On Jun 13, 7:06 am, Spartacus <nos...@nowhere .comwrote:
>Hello,
I know there is lots of information out there and I've taken a look, but I want to learn how to do this myself. And I'm a beginner here and some of it I don't understand (so no flames, RTFM or GFGI please ;)
Here's my function:
function send_mail($to_n ame, $to_email, $from_name, $from_email, $subject, $message) { $thedate = date("r", time());
$headers = "X-Mailer: PHPMailProgram/1.0\n"; $headers .= "From: \"".$from_name. "\" <".$from_email. ">\n"; $headers .= "Date: $thedate\n"; $headers .= "Content-Type: text/plain\n\n";
$from = "\".$from_name. "\" <".$from_email. ">";
return mail( $from, $subject, $message, $headers);
}
My problem is that it will never arrive with the "Name" <email address>, and I can only make it work using email addresses without the names or the angle brackets around the email addresses. Once I tried printing the headers and the quotes and angle brackets turned up, but no names or email addresses. And once an email arrived but with nothing but angle brackets! (I wonder how that happened? The SMTP server must have stripped things out perhaps?)
Thanks for your time in helping me with this,
Spartacus
First, headers need to be separated by "\r\n", not just "\n". Try
that and see if it works any better.
Well, the \n worked fine on both my server and my local machine, but
I've changed everything to \r\n anyway.
Everything now works, strangely enough. I must have a dud server or the
server's sendmail doesn't like names and angle brackets. Running my PHP
mailer on my machine at home works just fine using the Windows SMTP
server, name and angle brackets, no problems at all. Weird.
Thanks for your help.
Spartacus This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: >>Shailesh |
last post by:
hi,
my script(IMAP email client) is sending mail using imap_mail()
function.
imap_mail($To, $Subject, $Body, $headers);
$headers = "From: <$From>\n";
$headers .= "X-Sender: <$U@$DOMAIN>\n";
|
by: splicemix |
last post by:
Hi all,
I have recently set up a Drupal website. I am a beginner. My shared
host server does not allow nobody@localhost to send emails, and
prevents access to php.ini, so I spent some time getting a SMTP script
running. While the Drupal feedback module and the new account creation
works fine in terms of sending of mails, I am having some problems with
the sending of password reminder emails.
warning: Cannot modify header information -...
|
by: Ramon |
last post by:
Hello,
when I send an email using the mail() function, I get a Runtime Notice:
date() : It is not safe to rely on the system's timezone
settings. Please use the date.timezone setting, the TZ environment variable
or the date_default_timezone_set() function. In case you used any of those
methods and you are still getting this warning, you most likely misspelled
the timezone identifier. We selected 'Europe/Paris' for '2.0/DST' instead.
|
by: MJ |
last post by:
I use the following code to send mails using php usinf PEAR package.
When I run this code from command line using the command "php
automaticMail.php" the code works fine.
But when i run this script from browser it give the error :
Starting..... Error sending mail: (unable to connect to smtp server
10.110.8.212:25) End of Program
I am not figure out how this could happen ??? Sam code runs from
command line sending mails correctly but...
|
by: sravani1 |
last post by:
Hi,
I run the following code error will occure. Plz tell that what mistake i have done
<?php
// multiple recipients
$to = 'sravani_409@yahoo.com' . ', '; // note the comma
$to .= 'jyothsna11_123@yahoo.com';
// subject
$subject = 'Birthday Reminders for August';
| |
by: pavani1 |
last post by:
hi,
i used the below code i got the message field with the html tags. plz tell that what's the problem in my code. <?php
$to ='$_POST";
$subject = "Site Registration Confirmation";
$message = "<html>
<head>
<title>Site Registration Confirmation</title>
</head>
|
by: swethak |
last post by:
hi,
i run the below code i got the below error when i run in my local system.And i placed same program in website it works fine.plz tell that what's the mistake in that.
<?php
$to ="aa@gmail.com";
$subject = "Site Registration Confirmation";
$message = '<html>
|
by: Call Me Tom |
last post by:
The following simple script receives data from a form and sends me an
email. It works fine on my testing machine (xampp for windows).
However, when I upload it to my web host, the script processes but I
do not receive the email. I have used two different email addresses
and both work from the localhost and both fail from the web host. One
email address is at verizon.net and the other at gmail.com. I have
also checked the spam folders and...
|
by: urbanedge |
last post by:
I've uploaded a site to a new server and now the headers in the mail function are not working to send the required email response. This is a newly acquired site and my php knowledge is at the beginner level. I've managed to list the headers that are being sent but I can't seem to find where or why the email won't work. I'd really appreciate some help checking to see if there is an error in one of the header lines or perhaps the redirection. ...
|
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: 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: 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: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |