vidfalt1984 posted on 2011-01-26 19:29:43 #
What I want is the option to remove the input codes of the "to-address" and the subject line. I know how to do that, but where do I fill in the e-mail address and the subjectline?
I'm a total newbee when it comes to PHP. So I would appreciate the code and a small description of where to fill in what.
I use the versions 2006-01-23 of Attach Mailer and the Easy Upload. Both works perfectly as is.
The most popular forum posts:
Comments / discussions
Olaf posted on 2011-01-27 07:39:47 #
Hi,
what do you mean with "remove the input codes"?
Is this about e-mail header injections?
vidfalt1984 posted on 2011-01-27 12:32:26 #
Hello
What I mean is I want to remove the option of filling in the mail address and subject. I want to show the following options: add an image and fill in the clients name, telephone, e-mail and two checkboxes.
The "To" and "Subject" I want as a pre-typed thing that is hidden away from the client.
Olaf posted on 2011-01-28 11:49:27 #
Hi,
Use pre-defined variables, it's not required to use some user input.
vidfalt1984 posted on 2011-02-02 08:27:19 #
Hello
As I'm not familiar with PHP formscripting. I've tried to fill in the necessary to-address and subject like the following:
var $mail_to = "email@email.com";
var $mail_subject = "Competition";
But I receive an error that the mail hasn't been delivered.
The upload aspect to the server is still intact and works great.
Olaf posted on 2011-02-02 08:43:52 #
Hi,
Maybe the "mail()" function is disabled on your server?
vidfalt1984 posted on 2011-02-02 09:36:37 #
When I try the script in its original and fill in the "to" and the "subject" the script works fine. So I belive it's somewhere in my coding that has the fault.
Olaf posted on 2011-02-02 10:49:31 #
Do you tried the example file? Using classes you need to create an object first
vidfalt1984 posted on 2011-02-06 10:26:33 #
I still don't know how to make the code. What do I need to copy and place? What needs to be removed?
Olaf posted on 2011-02-06 11:45:07 #
Quote from: vidfalt1984
"I still don't know how to make the code. What do I need to copy and place? What needs to be removed?"
This is not how it works, you don't provide enough information. Re-check the manual from file from both classes and read also about the basic functionality of php classes in the php manual.
I get the idea that your php knowlegde is too limited ;) so it's time to learn...
vidfalt1984 posted on 2011-02-06 20:54:16 #
Hello
I've gotten it to work with a pre-inputted e-mail adress and subject. Now I need to find a way to get some more info in the message area of the mail. Could you point me in the right direction?
I have created new inputs: [from_tfn], [from_age] and a checkbox [mail_newsletter]. How do I add them to the [$mail_message = $this->mail_body;]?
I've also had a problem with Scandinavian letters . How can I get them to work?
Olaf posted on 2011-02-07 20:01:08 #
I have created new inputs: [from_tfn], [from_age] and a checkbox [mail_newsletter]. How do I add them to the [$mail_message = $this->mail_body;]?
this not really PHP code ;) Please post the related code snippet (not the class) and maybe you can insert a link to the page in question?
I've also had a problem with Scandinavian letters . How can I get them to work?
This depends more on your server configuration, use utf-8 to as encoding style
vidfalt1984 posted on 2011-02-07 23:16:42 #
http://www.arsonaut.net/testform/upload_and_mail_example.php
There's the form in it's primitive state. I will try the utf-8 encoding tomorrow. But I still don't know how to add the tfn, age and newsletter to the e-mail message.
vidfalt1984 posted on 2011-02-09 16:22:57 #
Have you had the time to check the link? I would like to get the solution soon. I would have use of this function this week.
vidfalt1984 posted on 2011-02-10 06:33:21 #
I received your test, Olaf. But as I said, it only contains the from address, the name, the message and the attached image. The tfn and the newsletter options do not appear. Could you advise me on how to add those strings to the mail message?
Olaf posted on 2011-02-10 07:50:16 #
Hi,
I'm sorry for the delay (busy times these days)
You need to add the form vars ot the message body like:
$body = 'hello '.$_POST['name'].',
some text
another post var: '.$_POST['somedate'];
vidfalt1984 posted on 2011-02-11 08:45:42 #
I don't understand the line you just wrote. I'm in the file "attach_mailer_class.php" and on line 184
$mail_message = $this->mail_body;
. If I change the mail_body to from_age, that information will be posted in the message. How do you add more information to that line?
Olaf posted on 2011-02-11 09:25:43 #
just like this:
$mail_message = $this->mail_body;
$mail_message .= $_POST['name'].' some text here';
$mail_message .= ' more text here';
Notice the dot in front of the equal sign
vidfalt1984 posted on 2011-02-11 10:35:55 #
When I added the line:
$mail_message = $this->mail_body;
$mail_message .= $_POST['from_tfn'];
I received the mail with both in the message, but there was a whole lot of information in the mail. Starting with:
--_c6ae4fde868d324bd9c135bf19829dff
Content-type:image/jpeg;
name="1297420377.jpg"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="1297420377.jpg"
/9j/4AAQSkZJRgABAQEBLAEsAAD/2wBDAAICAgICAQICAgIDAgIDAwYEAwMDAwcFBQQGCAcJCAgH
CAgJCg0LCQoMCggICw8LDA0ODg8OCQsQERAOEQ0ODg7/2wBDAQIDAwMDAwcEBAcOCQgJDg4ODg4O
Dg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg7/wAARCAHWAZUDAREA
AhEBAxEB/8QAHgAAAQQDAQEBAAAAAAAAAAAABgAEBQcBAgMICQr/xABREAACAQMDAgQEAgUICAMH
AQkBAgMEBREAEiEGMRMiQVEHFDJhcYEIFSNCkRlSoaaxwdHUCRYkM1di4fBDcvEXJTQ3RFPCdpKi
VGNl0oSFsv/EABsBAAIDAQEBAAAAAAAAAAAAAAAEAgMFAQYH/8QAPREAAQMCBAMHBAICAgIBAwUB
AQACEQMhBBIxQVFhcRMigZG...
It didn't have the image attached and the code went on and on.
Olaf posted on 2011-02-11 10:45:18 #
please post here the code from the link you've posted above
vidfalt1984 posted on 2011-02-11 10:47:08 #
This is the entire code:
function process_mail() {
if (!$this->valid_mail_adresses) return;
$mail_message = $this->mail_body;
$mail_message .= $_POST['from_tfn'];
if (count($this->att_files) > 0) {
foreach ($this->att_files as $val) {
$mail_message .= $val;
}
$mail_message .= "--".$this->uid."--";
}
if (mail($this->mail_to, $this->mail_subject, $mail_message, $this->mail_headers)) {
$this->msg[] = "Your mail is succesfully submitted.";
} else {
$this->msg[] = "Error while sending you mail.";
}
Olaf posted on 2011-02-11 10:50:26 #
Do you changed the class code?
This is not how it works, you need to create objects from the class (check how it is done in the example file)
vidfalt1984 posted on 2011-02-11 11:58:28 #
Is it this? This is taken from attach_mailer_class.php.
class attach_mailer {
var $from_name;
var $from_tfn;
var $from_mail;
var $from_age;
var $mail_to;
var $mail_cc;
var $mail_bcc;
var $mail_headers;
var $mail_subject;
var $mail_body = "";
var $mail_newsletter = "";
Or this?
if ($this->valid_mail_adresses) {
$this->from_name = $this->strip_line_breaks($name);
$this->from_mail = $this->strip_line_breaks($from);
$this->mail_to = $this->strip_line_breaks($to);
$this->mail_cc = $this->strip_line_breaks($cc);
$this->mail_bcc = $this->strip_line_breaks($bcc);
$this->mail_subject = $this->strip_line_breaks($subject);
$this->create_mime_boundry();
$this->from_tfn = $this->create_msg_body($tfn);
$this->from_age = $this->create_msg_body($age);
$this->mail_body = $this->create_msg_body($body);
$this->mail_newsletter = $this->create_msg_body($newsletter);
$this->mail_headers = $this->create_mail_headers();
} else {
return;
vidfalt1984 posted on 2011-02-11 12:02:43 #
Or this? This is taken from the upload_and_mail_example.php file:
if(isset($_POST['Submit'])) {
$my_mail = new attach_mailer($name = $_POST['from_name'], $tfn = $_POST['from_tfn'], $from = $_POST['from_email'], $age = $_POST['from_age'], "myemail@myemail.com", $cc = "", $bcc = "", "Comptetition", $body = $_POST['mail_body'], $newsletter = $_POST['mail_newsletter']);
Olaf posted on 2011-02-11 12:49:27 #
yes this is much better, now you need to modify the value for the "body" variable (like in the example above)
vidfalt1984 posted on 2011-02-15 15:03:30 #
So this:
$this->mail_body = $this->create_msg_body($body);
Will become this:
$this->mail_body = $this->create_msg_body($body, $tfn, $age);
Olaf posted on 2011-02-15 21:32:52 #
No ;) try
$body = $body.' '.$tfn.' '.$age;
$this->mail_body = $this->create_msg_body($body);
vidfalt1984 posted on 2011-02-16 07:03:54 #
In the "upload_and_mail_example.php" file, line 18
So this line:
, $body = $_POST['mail_body'],
Will become:
, $body = $body.' '.$tfn.' '.$age,
-- -- -- -- --
Or is it here "attach_mailer_class.php":
if ($this->valid_mail_adresses) {
$this->from_name = $this->strip_line_breaks($name);
$this->from_mail = $this->strip_line_breaks($from);
$this->mail_to = $this->strip_line_breaks($to);
$this->mail_cc = $this->strip_line_breaks($cc);
$this->mail_bcc = $this->strip_line_breaks($bcc);
$this->mail_subject = $this->strip_line_breaks($subject);
$this->create_mime_boundry();
$body = $body.' '.$tfn.' '.$age;
$this->mail_body = $this->create_msg_body($body);
$this->mail_newsletter = $this->create_msg_body($newsletter);
$this->mail_headers = $this->create_mail_headers();
} else {
return;
Olaf posted on 2011-02-16 07:16:44 #
Don't touch the class scripts :)
I got the idea that you didn't know what variable is. Without this knowledge your are FAR away from writing code or even scripts. I suggest to follow several php beginner tutorials or if don't like to learn PHP, there are many php developers you can hire.
Sorry, but I lost my patience here...
vidfalt1984 posted on 2011-02-16 07:32:20 #
Hi Olaf
I really appreciate your help and I belive the script you have written is what I need in a project. I would really like for you to help me get the message of the mail to include the tfn, age and newsletter. The script works great otherwise.
We've come far from what we started out with. So I ask of you to please help me with this last hurdle.
Olaf posted on 2011-02-16 07:46:46 #
okay in this case start with basic search google for "php beginner tutorials", the php manual is also a great source to learn the basics.
vidfalt1984 posted on 2011-02-16 08:15:38 #
Hi Olaf,
I got the script to work through trial and error. I want to thank you for all your help and assistance thus far.