PHP Classes

smtp_message and html_message with attachments

Recommend this page to a friend!

      MIME E-mail message sending  >  All threads  >  smtp_message and html_message with...  >  (Un) Subscribe thread alerts  
Subject:smtp_message and html_message with...
Summary:diferent functions for sending mail
Messages:6
Author:Lurias
Date:2006-09-18 22:11:52
Update:2006-09-19 18:11:11
 

  1. smtp_message and html_message with...   Reply   Report abuse  
Picture of Lurias Lurias - 2006-09-18 22:11:52
I've tried and understanded the examples of the files test_smtp_mail.php and test_attachment_message.php

Now I need to use both solutions: I want to be able to send an HTML message with attachments using the smtp_message class

My problem is that the test_attachment_message.php uses the send() function (no parameters needed); while the test_smtp_mail.php the example uses the smtp_mail() function (wich requires parameters).

I understand that the send() function is a wrapper that after the use of serveral function calls (AddQuotedPrintableTextPart(), SetEncodedHeader(), AddFilePart(), etc.) sets the equivalent to the variable $additional_headers variable in the smtp_message_class

My question is:

How can I combine both examples in order to send messages with attachments using smtp_message_class?

or

How do i:
1) (manually?) attach files to the message
2) set the $additional_headers variable
in order to use the smtp_mail funtion?

  2. Re: smtp_message and html_message with...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2006-09-19 00:57:38 - In reply to message 1 from Lurias
I think it is better for you to understand to pick the example test_html_mail_message.php .

After where it says

require("email_message.php");

insert:

require("smtp_message.php");
require("smtp.php");

Where it says:

$email_message=new email_message_class;

replace by

$email_message=new smtp_message_class;
$email_message->smtp_host="your.smtp.server.com";

Adding attachments and setting additional headers is explained in the test_html_mail_message.php example.

  3. How to send a cron mail   Reply   Report abuse  
Picture of mahes mahes - 2006-09-19 12:35:57 - In reply to message 2 from Manuel Lemos
Dear Friends,

Am not much avare in cron mail.pls give a detail for how we can send a message automatically per a day(cron mail).

  4. Re: smtp_message and html_message with...   Reply   Report abuse  
Picture of Lurias Lurias - 2006-09-19 13:53:10 - In reply to message 2 from Manuel Lemos
Thanks A LOT. Thatīs what I call a very well coded class



  5. Re: smtp_message and html_message with...   Reply   Report abuse  
Picture of Lurias Lurias - 2006-09-19 14:20:11 - In reply to message 3 from mahes
Using a Redhat based distribution:

in /etc/crontab you will find the settings for cron job; the common settings usually call different directories for daily, hourly, montly jobs (/etc/cron.daily, /etc/cron.monthly and so on)

you can find out how to run a php script from bash (so you can put it in a cron job) in http://www.phpbuilder.com/columns/darrell20000319.php3

  6. Re: smtp_message and html_message with...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2006-09-19 18:11:11 - In reply to message 3 from mahes
If you have shell access you need to edit your Web user crontab entry using the crontab -e command .

By default it starts the vi editor. In that case use ESC key, shift-g followed by i keys . The cursor appears at the end of the crontab file. Then type something like:

0 0 * * * /path/to/php-cli -q /path/to/your/script.php

Then use ESC key, and type :wq followed by the return key .

Note, /path/to/your/script.php is the full path of your script file. /path/to/php-cli is the full path of PHP CLI version program. If you do not know the full path, enter which php in the shell.