Auto Email

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Nope, not a silly question.

I think the easiest way to do this is setup some type of third party auto-repsonder software. If you don't run your own server, speak to your server admin about what type of auto-responders they have installed.

-Andrew Riley

Autoresponder

An autoresponder / courtesy reply would be great. I do this:

# Autoresponder #############################################################
$filename = "answer.txt";
$fd = fopen( $filename, "r" );
$contents = fread( $fd, filesize( $filename ) );
fclose( $fd );
mail( "$email", "Thanks for your message", "$contents\n\n",
"From:webmaster@mydomain.com\n" );
#############################################################
Also allowing attachments with the coutesy reply, and a BFORMMAIL type database facility would be great.

Autorespond

Thanks Cris!
- Works perfect!.. NOW it's GREAT!

Autoresponder with PDF!!

Been trying to solve this all day, now an Autoresponder with a PDF attachment. Absolutely brill!

<?

$filename = "answer.txt";
$fd = fopen( $filename, "r" );
$msg = fread( $fd, filesize( $filename ) );
fclose( $fd );

$attachment = fread(fopen("test.pdf", "r"), filesize("test.pdf"));

$mail = new mime_mail();
$mail->from = "info@yourdomain.de";
$mail->to = $eMail;
$mail->subject = "Blah blah";
$mail->body = $msg;
$mail->add_attachment("$attachment", "test.pdf", "application/pdf");
$mail->send();

/*
* Class mime_mail
* Original implementation by Sascha Schumann
* Modified by Tobias Ratschiller :
* - General code clean-up
* - separate body- and from-property
* - killed some mostly un-necessary stuff
*/

class mime_mail
{
var $parts;
var $to;
var $from;
var $headers;
var $subject;
var $body;

/*
* void mime_mail()
* class constructor
*/
function mime_mail()
{
$this->parts = array();
$this->to = "";
$this->from = "";
$this->subject = "";
$this->body = "";
$this->headers = "";
}

/*
* void add_attachment(string message, [string name], [string ctype])
* Add an attachment to the mail object
*/
function add_attachment($message, $name = "", $ctype = "application/octet-stream")
{
$this->parts[] = array (
"ctype" => $ctype,
"message" => $message,
"encode" => $encode,
"name" => $name
);
}

/*
* void build_message(array part=
* Build message parts of an multipart mail
*/
function build_message($part)
{
$message = $part[ "message"];
$message = chunk_split(base64_encode($message));
$encoding = "base64";
return "Content-Type: ".$part[ "ctype"].
($part[ "name"]? "; name = \"".$part[ "name"]. "\"" : "").
"\nContent-Transfer-Encoding: $encoding\n\n$message\n";
}

/*
* void build_multipart()
* Build a multipart mail
*/
function build_multipart()
{
$boundary = "b".md5(uniqid(time()));
$multipart = "Content-Type: multipart/mixed; boundary = $boundary\n\nThis is a MIME encoded message.\n\n--$boundary";

for($i = sizeof($this->parts)-1; $i >= 0; $i--)
{
$multipart .= "\n".$this->build_message($this->parts[$i]). "--$boundary";
}
return $multipart.= "--\n";
}

/*
* void send()
* Send the mail (last class-function to be called)
*/
function send()
{
$mime = "";
if (!empty($this->from))
$mime .= "From: ".$this->from. "\n";
if (!empty($this->headers))
$mime .= $this->headers. "\n";

if (!empty($this->body))
$this->add_attachment($this->body, "", "text/plain");
$mime .= "MIME-Version: 1.0\n".$this->build_multipart();
mail($this->to, $this->subject, "", $mime);
}
}; // end of class
?>

Auto Email

I'm kinda new to Php. Do I just have to add this lines for the autoresponder from Cris to Phpformmail.php. I did that but it is not working.

Can anyone of you help me fixing this problem

Thanks! flint

E-mail Reply

Help

I am new to PHP/Scripting and I am trying to do the following:

I am trying to setup an E-mail automatic responce in the formmail script can anyone post a "fool proof method" I have tried the above and cannot get them 2 work?

It would be great to see exactly where to insert the script into the formmail.php script!!

Many Thanks

Nathan

Stalk me!

Drupal Association Member