PHP Classes

get specific massage in email

Recommend this page to a friend!

      SMTP E-mail sending class  >  All threads  >  get specific massage in email  >  (Un) Subscribe thread alerts  
Subject:get specific massage in email
Summary:no subject and specific massage in email
Messages:12
Author:stanislav bez
Date:2009-06-04 19:55:19
Update:2009-06-10 05:00:17
 
  1 - 10   11 - 12  

  1. get specific massage in email   Reply   Report abuse  
Picture of stanislav bez stanislav bez - 2009-06-04 19:55:19
Hello.
i tried script by sending email. and got email without subject and in the beginning email such text:
Subject: "my subject of email"
From: my name <stasbz@mydomain.ru>
MIME-Version: 1.0
Content-Type: text/plain
Date: Thu, 04 Jun 2009 23:46:33 MSD
Message-ID: <20090604234633.8525.stasbz@mydomain.ru>

and then text of my email i sent.

What is it? how get ride of it?

p.s. i tried it script on some hostings and got it everywhere.

  2. Re: get specific massage in email   Reply   Report abuse  
Picture of stanislav bez stanislav bez - 2009-06-04 21:36:05 - In reply to message 1 from stanislav bez
I use a PHP application written using the mail function and i used to
change it to relay messages to an SMTP service.
That script:
<?php
set_time_limit(0);
require_once("smtp_mail.php");
$url_home = "/home/a/abcjeansru/public_html/mail/";
$date = fopen($url_home . "num.php", "r");
$date_str = fgets($date, 4096);
fclose($date);
$lines = file($url_home . $date_str . ".txt");
$massage = 'Hi. how are you';
$i = 0;
foreach ($lines as $line_num => $line) {
$CurrentStr = htmlspecialchars($line);
$to= ltrim($CurrentStr, "\x00..\x1F");
smtp_mail($to, "subject",
$massage, "From: Stanislav <stasbz@mydomain.ru>");
$i += 1;
if ($i == 1) {
sleep(8);
$i=0;
}
$CurrentStr="";
}
$date_str +=1;
$date_write_file = fopen($url_home . "num.php", "w");
fwrite($date_write_file, $date_str);
fclose($date_write_file);
echo($date_str);
?>
so i have num.php and 1.txt file with emails of my clients.

  3. Re: get specific massage in email   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2009-06-04 22:57:25 - In reply to message 1 from stanislav bez
The headers should be passed in header lines.

Anyway, it is recommended that you use the MIME message class in conjunction with this class when you want to send messages via SMTP because the MIME message class knows better how to compose and send Internet e-mail standards compliant messages.

phpclasses.org/mimemessage

  4. Re: get specific massage in email   Reply   Report abuse  
Picture of stanislav bez stanislav bez - 2009-06-05 13:45:30 - In reply to message 3 from Manuel Lemos
i placed headers in header lines

<?php
$subject = "My email test.";
$message = 'hi';

$headers = "From: stas <stasbz@abxxxns.ru>\r\n";

...
....
?>
and nothing changed.
please what should i write in this code and what clases use?

  5. Re: get specific massage in email   Reply   Report abuse  
Picture of stanislav bez stanislav bez - 2009-06-05 16:22:06 - In reply to message 4 from stanislav bez
i changed smtp_mail ($to, $subject, $message, $headers);
to
smtp_mail ("stas@mydomain.com", $subject, $message, $headers);
and get normal email.

  6. Re: get specific massage in email   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2009-06-05 16:54:22 - In reply to message 5 from stanislav bez
That should work. Otherwise, I need you to show me a complete script with sufficient code so I can reproduce the problem.

  7. Re: get specific massage in email   Reply   Report abuse  
Picture of stanislav bez stanislav bez - 2009-06-05 17:27:46 - In reply to message 6 from Manuel Lemos
i had to tell you that if i use
smtp_mail ($to, $subject, $message, $headers);
so i get email with specific text, but my script should you use such form because i take different emails from txt file. But i try as an experiment such code (changed $to -> "stas@mydomain.com")
smtp_mail ("stas@mydomain.com", $subject, $message, $headers);
and get normal email.

there are different forms of script, for a example:
<?PHP
set_time_limit(0);
require_once("smtp_mail.php");
$to = file('emails.txt');
$sleep = 10;
$subject = 'Birthday Reminders for August';
$message = 'hi';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: Birthday Reminder <stasbz@mydomain.ru>' . "\r\n";
for ($i = 0; $i < count($to); $i+=10)
{
smtp_mail(implode(',',array_slice($to, $i*10, 10)),$subject,$message,$headers);
sleep(10);
}
?>

the main task is
1) get emails from txt file or diferent way.
2) after some emals 've sent take a pause for 10 sec. and so on.

But when i use "$to" in php script i get email this specific text without subject.

  8. Re: get specific massage in email   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2009-06-05 22:21:34 - In reply to message 7 from stanislav bez
I think your problem is due to the fact that file() function splits lines into array entries but each line will include the line break separator. You need to clear the line breaks at the end of each address line before you pass it to the smtp_mail() function.

  9. Re: get specific massage in email   Reply   Report abuse  
Picture of stanislav bez stanislav bez - 2009-06-10 04:23:54 - In reply to message 8 from Manuel Lemos
yes. it works. you are wright. thanks.

but next problem is:
when i send emails by outlook from my computer, all emails (about 100) are going to inbox.
but when i sent from web hosting using your php classes script , just first emails (maybe 5 emails) are going to inbox, but others are returened as spam and not delivered.
i am using my script with "require_once("smtp_mail.php");" and
change mail () function to smtp_mail ().
and in my folder in web hosting i have classes smtp_mail.php and
email_message.php, smtp_message.php, smtp.php.
what is problem?
please help!
what should i do?

  10. Re: get specific massage in email   Reply   Report abuse  
Picture of stanislav bez stanislav bez - 2009-06-10 04:33:45 - In reply to message 9 from stanislav bez
i sent from one web hosting but through different email accounts (different proveiders).

 
  1 - 10   11 - 12