• Content count

  • Joined

  • Last visited

Community Reputation

29 Excellent

About ryanC

  • Rank
    Full Member
  1. Thanks flydev! I pasted your code into my template, and I got the attachment in the email! I owe you a beer. I've been slowly reading the php documentation on file uploading, to try to understand the theory behind all this stuff, so I can better understand the tips you guys are giving me. Thanks again!
  2. Thank you Adrian! I will get started with this.
  3. Ok guys, this is going to be my last question for awhile. I am really trying here, and I'm getting really frustrated. I just went to stack overflow and asked a question hoping someone would helpfully explain to me how image attachment works, and I instantly got a bunch of down-votes. If at some point, someone could just in simple english give me a paragraph or two of the theory behind image attachment... not even the code to make it happen, just an overview of how the process works for someone with limited PHP knowledge. From that, I can probably do some forum searches on updating my script. In the mean time I believe I will see what PHPMailer is all about, I can do a simple contact form now through processwire so I am happy about that.
  4. Bernhard, I had this post up for a few days, and didn't get a response so I figured that was because it was in the wrong area.
  5. Thanks adrian, yeah I know I'm way out of my element here. I appreciate the help given with my site by you guys. As of now, I have form that works and sends emails. If I have to leave it at that, I can live with it for now until I learn more about PHP. Regarding the "known path to image", that's what I can't really get my head around... I don't know what that path is. All I know is the "path" is the actual field itself is "user-image". I'm trying to speak in full sentences with this stuff and I'm still learning basic vocabulary. As of now, I can LITERALLY do anything in processwire I would want for a website EXCEPT put an image in an email. So that is something! I'm re-reading posts in these forums over and over again, trying to get it... I will figure it out eventually.
  6. Thanks horst, my form uses POST method. I will see if I can apply some of what you wrote to my code.
  7. Does anyone have ideas on this? I guess there is way more to it than just the wireMail attachment code above. I've been looking at swiftmailer, php mailer...of those two, which would be easiest to integrate into ProcessWire for attachments?
  8. Hi Fractalflux, I'm also a designer with a lot of HTML/CSS experience but very minimal PHP. It can be challenging, but once you wrap your head around where to place the processwire/php tags, you can do quite a bit. I was really struggling when I got started, but with some help from the forums I'm wrapping up a website that has a lot of functionality. I chose this route because as someone who is more confident just writing my HTML and CSS by hand, I was looking for a CMS that would let me do as much by hand as possible, and I didn't want to get into WP etc. and something where all my options were pre-cooked modules that I had to code AROUND. I've had enough of coding around pre-made systems. I think once you know the basics of how to create your templates, and how to make sure your links/images show up correctly, it's basically back to HTML/CSS mode.
  9. So, taking my code from earlier that makes a temporary upload path, I have: $upload_path = $config->paths->assets . "files/useruploads/"; then $userimage = 'user_image'; $mail->attachment($upload_path->$userimage); $mail->send(); what am I leaving out?
  10. Hi, I am trying to implement wireMail attachment method into my form. I started a thread in the 'getting started' area but maybe this is the better place for it since it is specifically about wireMail. Basically I just want someone to be able to add an image to a form, then send it in an email. The field in my form is: <input type="file" name="user_image" /> I've been looking at this thread and trying to cobble something together. I am very new to php. I know this is wrong but this is as far as I can make out what I'm supposed to do: $user_image = 'user_image->$filename'; $mail = wireMail(); $mail->attachment($filename); $mail->send(); Any links to any other forum threads, or php info, would be greatly appreciated. I've been trying to figure this out for two days. The documentation at https://processwire.com/api/ref/wire-mail/attachment/ is nice and simple but too simple for where my understanding is at. Thanks!
  11. documentation for wireMail attachment says: $m->attachment(string $value); string = Full path and filename of file attachment. But I get lost here. In my form, $value is $user_image. But how do I find out the path when it's just someone's computer desktop? Am I anywhere near coding this correctly? I am trying a hybrid of the attachment documentation and posts from this thread: https://processwire.com/talk/topic/5704-wiremailsmtp/?page=7&tab=comments#comment-142333 my form image field is called user_image. This is my script: $user_image = 'user_image'; $tempname = $user_image->$filename; $mail = wireMail(); $mail->attachment($tempname); $mail->send();
  12. Hi flydev, I tried that a little last week but I'm missing something. I'm still pretty new to php so I know there is a step I'm leaving out. I had already tried these: $mail->attachment($config->paths->assets . "files/useruploads/"); $mail->attachment($user_image->$config->paths->assets . "files/useruploads/"); $mail->attachment($files); $mail->attachment($user_image); then... $mail->send(); But the image isn't included with the form content. Is it being canceled out by the wireUpload code that precedes it? I would actually much prefer the $mail->attachment method, but since that wasn't doing anything I settled for the wireUpload putting the image on the backend.
  13. Hi, I am getting close to finishing the form I've been working on. My goal is to have users upload an image in the form, and have that image be sent along with the rest of the email content. Taking code from a suggested thread, I am able to get the user uploaded image into my assets folder (which is in the code below). So I can at least receive the image... but I would like for that image to be sent in the content of the email instead. Would I be able to modify my code to do that? The section of the script that sends the image to the assets folder starts with //image upload begin: <?php $email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL); $email .= $_REQUEST['email']; if (isset($_POST['submit']) and ($_POST['email']) and ($_POST['comments']) ) { //image upload begin $upload_path = $config->paths->assets . "files/useruploads/"; $user_image = new WireUpload('user_image'); // References the name of the field in the HTML form that uploads the photo $user_image->setMaxFiles(5); $user_image->setOverwrite(false); $user_image->setDestinationPath($upload_path); $user_image->setValidExtensions(array('jpg', 'jpeg', 'png', 'gif')); // execute upload and check for errors $files = $user_image->execute(); //image upload end $to = 'me@email.com'; $subject = 'Feedback from my site'; $message = 'Name: ' . $sanitizer->text($input->post->name) . "\r\n\r\n"; $message .='Email: ' . $sanitizer->email($input->post->email) . "\r\n\r\n"; $comments = $sanitizer->entities($sanitizer->textarea($input->post->comments)); $message .= 'Comments: ' . $comments; $success = $email; $success .=$message; $mail = wireMail(); $mail->to($to)->from('me@email.com'); $mail->subject($subject); $mail->body($message); $mail->send(); } else { header("location: error-page"); exit; } ?> <form id="option3form" action="./" method="post" enctype="multipart/form-data" target="_blank"> <label for="name">Name: </label> <input type="text" name="name" id="name"> <label for="email">Email: </label> <input type="email" name="email" id="email"><br /><br /> <label for="comments">Comments: </label> <textarea name="comments" id="comments"></textarea><br /><br /> <p>Click the "Choose File" button below to upload your image.</p> <input type="file" name="user_image" /> <input type="submit" name="submit" value="Submit"> </form> Thanks!
  14. Thanks szabesz, for the code and the link. I've noticed the Gmails are coming in regularly again, so I guess that part is out of my hands. I've gotten the form working and sending emails, thanks to the help from you guys so I'm going to mark this as solved. I will probably be back asking more about wireMail at some point, but that would be for a different thread.
  15. Thanks for that form example, webhoes!