I have a form for club members to send an email. The members might want to send a text only email with no attachment, or a email with an attachment.
The class works perfectly when send mail with 1 or more attachments, but when I send the mail with no attachment, the email never arrives. I am testing with the "attach_mailer_example.php". When I comment out the 2 "add_attach_file" lines and execute the script, the page displays "mail successfully submitted", but the mail never arrives. When I un-comment the "add_attach_file", the mail is sent and arrives immediately.
I look at the code in the class and it appears that it is supposed to work without attachments. Any ideas?
PHP attachment mailer class won't send mail without at least 1 attachment.
» PHP Forum Archive » PHP Classes Support Forum
The most popular forum posts:
Comments / discussions
hello Jim,
the class is a result of some study and never left the early beta status.
I used the class in several applications with and without attachments.
do you use different code for both cases? Which code do you use in both cases?
Hi Olaf
Here is a cut & paste from the actual code that works.
<?php
// send mail without attachment
require("attach_mailer_class.php");
$test = new attach_mailer($name = "Jim", $from = "jim@jimbell.us", $to = "jim@jimbell.us", $cc = "", $bcc = "", $subject = "Test text email with attachments");
$test->text_body = "...Some body text\n\n the admin";
$test->add_attach_file("cpc logo.jpg");
$test->process_mail();
?>
Here is the code that does not work. The program runs without an error, but I never get the email
<?php
// send mail without attachment
require("attach_mailer_class.php");
$test = new attach_mailer($name = "Jim", $from = "jim@jimbell.us", $to = "jim@jimbell.us", $cc = "", $bcc = "", $subject = "Test text email with attachments");
$test->text_body = "...Some body text\n\n the admin";
//$test->add_attach_file("cpc logo.jpg");
$test->process_mail();
?>
As you can see, I just commented out the "add_attach_file" statement.
Thanks
Do you tried to send the same mail to other email addresses? Maybe to some gmail account?