473,382 Members | 1,373 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,382 software developers and data experts.

I Need Help in Using mail() Function!

Hello everybody,

When I send an email to any Hotmail account it goes directory to the
Junk Email!
My website is in a dedicated server using: Linux 2.4.21, Apa*che, PHP,
MySQL
I'm using the following function to send my emails:
==============================
<?
function SendEmail($veFmName, $veFmEmail, $veToName, $veToEmail,
$veSubj, $veBody) {
$bound="----=_NextPart_000_" . uniqid(rand());
$message = "This is a multi-part message in MIME format.\r\n\r\n";
// text
$message .= "--$bound\r\n";
$message .= "Content-Type: text/plain;
\r\n\tcharset=\"windows-1256\"\r\n";
$message .= "Content-Transfer-Encoding: base64\r\n\r\n";
$message .= "This is an HTML email." . "\r\n\r\n";
// html
$message .= "--$bound\r\n";
$message .= "Content-Type: text/html;
\r\n\tcharset=\"windows-1256\"\r\n";
$message .= "Content-Transfer-Encoding: quoted-printable\r\n\r\n";
$message .= $veBody;

$message .= "\r\n\r\n--$bound--";

$varHeader = "From: $veFmName <$veFmEmail>\r\n";
$varHeader .= "Return-Path: $veFmEmail\r\n";
$varHeader .= "MIME-Version: 1.0\r\n";
$varHeader .= "Content-Type: multipart/alternative;
boundary=\"$bound\"\r\n";
//$varHeader .= "X-Mailer: PHP Mailer\r\n";
$varHeader .= "X-Mailer: Microsoft Office Outlook, Build
11.0.6353\r\n";
$varHeader .= "X-MimeOLE: Produced By Microsoft MimeOLE
V6.00.2900.2180\r\n";
$varHeader .= $message;

return mail($veToEmail, $veSubj, "", $varHeader, "-f" . $veFmEmail);
}
// this is an example to use this function:
$varTitle = "Message Title Here";
$varBody = "The HTML body goes here.";
SendEmail("Sender Name", "My****@MyDomain.com", "",
"An******@hotmail.com", $varTitle, $varBody);
?>
==============================

Could you help me please!
Thanks.

Jul 17 '05 #1
4 1654
en********@gmail.com hu kiteb:
Hello everybody,

When I send an email to any Hotmail account it goes directory to the
Junk Email!
My website is in a dedicated server using: Linux 2.4.21, Apa*che, PHP,
MySQL
I'm using the following function to send my emails:


Your time might be better spent persuading the people involved that you
aren't actually sending them junk mail. People have installed those spam
filters for a reason, and I don't think any responsible person would
post a way to get around those filters in a public forum.

Of course, if it is the case that you actually are sending junkmails
with php, can't help you there.
--
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk

Jul 17 '05 #2
en********@gmail.com wrote:
Hello everybody,

When I send an email to any Hotmail account it goes directory to the
Junk Email!
My website is in a dedicated server using: Linux 2.4.21, Apa*che, PHP,
MySQL
I'm using the following function to send my emails:
==============================
<?
function SendEmail($veFmName, $veFmEmail, $veToName, $veToEmail,
$veSubj, $veBody) {
$bound="----=_NextPart_000_" . uniqid(rand());
$message = "This is a multi-part message in MIME format.\r\n\r\n";
// text
$message .= "--$bound\r\n";
$message .= "Content-Type: text/plain;
\r\n\tcharset=\"windows-1256\"\r\n";
$message .= "Content-Transfer-Encoding: base64\r\n\r\n";
$message .= "This is an HTML email." . "\r\n\r\n";
// html
$message .= "--$bound\r\n";
$message .= "Content-Type: text/html;
\r\n\tcharset=\"windows-1256\"\r\n";
$message .= "Content-Transfer-Encoding: quoted-printable\r\n\r\n";
$message .= $veBody;

$message .= "\r\n\r\n--$bound--";

$varHeader = "From: $veFmName <$veFmEmail>\r\n";
$varHeader .= "Return-Path: $veFmEmail\r\n";
$varHeader .= "MIME-Version: 1.0\r\n";
$varHeader .= "Content-Type: multipart/alternative;
boundary=\"$bound\"\r\n";
//$varHeader .= "X-Mailer: PHP Mailer\r\n";
$varHeader .= "X-Mailer: Microsoft Office Outlook, Build
11.0.6353\r\n";
$varHeader .= "X-MimeOLE: Produced By Microsoft MimeOLE
V6.00.2900.2180\r\n";
$varHeader .= $message;

return mail($veToEmail, $veSubj, "", $varHeader, "-f" . $veFmEmail);
}
// this is an example to use this function:
$varTitle = "Message Title Here";
$varBody = "The HTML body goes here.";
SendEmail("Sender Name", "My****@MyDomain.com", "",
"An******@hotmail.com", $varTitle, $varBody);
?>
==============================

Could you help me please!
Thanks.

1. Stop sending mail in html formats.
2. Stop pretending to be an email client that you're not.
3. Look at the headers you actually need, and send only those.
4. Start looking at the reasons why hotmail marks mail as spam.

Jul 17 '05 #3
en********@gmail.com wrote:
Hello everybody,

When I send an email to any Hotmail account it goes directory to the
Junk Email!
My website is in a dedicated server using: Linux 2.4.21, Apa*che, PHP, MySQL
I'm using the following function to send my emails:

<snip code>

Try PHPMailer <http://phpmailer.sourceforge.net/> instead. There are
more than one reasons for your mail to be trapped under junk mail. In
most of the cases I have had good results with PHPMailer. But, there
are certain cases, it won't work: 1. You're really sending junk mails,
2. You're not sending proper from/reply-to header, 3. You're domain or
email is blacklisted.

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Jul 17 '05 #4
Thanks for you all..

any other opinions..

Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Karuna | last post by:
Hi everybody, I have been trying to write a simple mail script using PHP and apache on Windows XP. Eventhough the script is saying that the mail is successfully sent, I am unable get it in my...
9
by: Jofio | last post by:
I am just learning PHP. I just tried coding a php script which I saved as mail.php ---------------------------- <? $name=$_POST; $email=$_POST; $comments=$_POST;
0
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
4
by: Duffey, Kevin | last post by:
I don't know if jdbc/java code requires this, but when I use two gui admin tools I found, and I insert a row into the table using their row editor feature, both require me to enter a number for the...
3
by: Martin | last post by:
Hi all, I have some VBScript code that I am trying to port over to VB.NET. I am receiving an error "Cast from type 'Field' to type 'String' is not valid." when calling the MapLegacyExchangeDN...
1
by: Eric D. Nielsen | last post by:
I'm in the process of implementing a "monitor this" type feature on a web-application. When something changes on the monitored item an email to the subscriber is generated. I'd like to do this...
6
by: ransoma22 | last post by:
I developing an application that receive SMS from a connected GSM handphone, e.g Siemens M55, Nokia 6230,etc through the data cable. The application(VB.NET) will receive the SMS automatically,...
7
by: oopsbabies | last post by:
Hello everyone, I am using Apache 1.3.33 as the web server and PHP version 4.3.10. My machine is using Windows XP 2002 professional edition which comes with a Windows firewall. I am using McAfee...
5
by: GuangXiN | last post by:
I need an stmp client to send email through my mail server. I don't want to use php's mail function. who can recommend some?
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.