Jump to content

Search the Community

Showing results for tags 'mail'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL







Found 13 results

  1. I wanted to view the contents of a JSON post in a web hook from an external application. In this instance the source application was Stripe posting event info at irregular intervals to a PW page URL. The process had to be unobtrusive. Solution was to send an email to myself. The web hook page template contained: // create a PW mail object using whatever method works for you $mail = wire()->modules('WireMailSmtp'); // Retrieve the request's body and parse it as JSON $stripe_input = @file_get_contents("php://input"); $event_json = json_decode($stripe_input); try { $body = "<pre>" . var_export($event_json, true) . "</pre>"; $mail->to('my@emailaddress.com'); $mail->from('from@emailaddress.com'); $mail->subject('test event_json'); $mail->bodyHTML($body); $mail->send(); } catch (\Exception $e) { $error = "Email not sent: " . $e->getMessage(); $mail->log($error); } Resulting email body contains nicely formatted code, eg: stdClass::__set_state(array( 'id' => 'evt_XXXXXXXXXXXXXXXX', 'object' => 'event', 'api_version' => '2016-07-06', 'created' => 1476900798, 'data' => stdClass::__set_state(array( 'object' => stdClass::__set_state(array( 'id' => 'sub_XXXXXXXXXXXXXXXX', 'object' => 'subscription', 'application_fee_percent' => NULL, 'cancel_at_period_end' => false, 'canceled_at' => NULL, 'created' => 1476900796, 'current_period_end' => 1508436796, 'current_period_start' => 1476900796, 'customer' => 'cus_XXXXXXXXXXXXXXXX', 'discount' => NULL, 'ended_at' => NULL, 'livemode' => true, 'metadata' => stdClass::__set_state(array( )), 'plan' => stdClass::__set_state(array( 'id' => 'annual', 'object' => 'plan', 'amount' => 8000, 'created' => 1474521586, 'currency' => 'usd', 'interval' => 'year', 'interval_count' => 1, 'livemode' => true, 'metadata' => stdClass::__set_state(array( )), 'name' => 'Annual', 'statement_descriptor' => NULL, 'trial_period_days' => NULL, )), 'quantity' => 1, 'start' => 1476900796, 'status' => 'active', 'tax_percent' => NULL, 'trial_end' => NULL, 'trial_start' => NULL, )), )), 'livemode' => true, 'pending_webhooks' => 1, 'request' => 'req_XXXXXXXXXXXXXXXX', 'type' => 'customer.subscription.created', ))
  2. hello processwire community, i am using LoginRegister module for front-end user registration. i am facing an issue verification email not receiving while WireMailSmtp is working perfectly and user receives message "Thank you, a confirmation code has been emailed to you. When you receive the email, click the link it contains, or paste the confirmation code below." received this message in front-end but does not receive any email relevant it. please help me in this case how i can solve it. Please check screen shots for SMTP test and message which receives user. Thanks AbdulQayyum, First screenshot SMTP test message, second when user receives message after clicking register button.
  3. Hi everyone ... Generally, this is about the new mailHTML() function that does not work correctly on processwire 3.0.110 https://github.com/processwire/processwire/blob/dev/wire/core/WireMailTools.php#L291 https://processwire.com/api/ref/mail/mail-h-t-m-l/ I do not know if I'm making a mistake trying to send an e-mail or if it's a bug in the core This is my code: <?php // $m = $mail->new(); // option A // $m = new WireMail(); // option B $m = wireMail(); // option C $m->mailHTML('alex@gmail.com', 'Hello', '<html><body><h1>Message Body</h1></body></html>'); $m->send(); ?> Details from Tracy Debugger SERVER DETAILS ProcessWire: 3.0.110 PHP: 7.2.8 Webserver: Apache/2.4.34 (Unix) MySQL: 10.1.34-MariaDB SERVER SETTINGS allow_url_fopen: 1 max_execution_time: 120 (changeable) max_input_nesting_level: 64 max_input_time: 60 max_input_vars: 1000 memory_limit: 256M post_max_size: 8M upload_max_filesize: 20M xdebug: xdebug.max_nesting_level: mod_rewrite: 1 mod_security: *confirmed off GD: 2.2.5 GIF: 1 JPG: 1 PNG: 1 EXIF Support: FreeType: 1 Imagick Extension: MODULE DETAILS TracyDebugger: 4.11.13
  4. Usually I write modules just for me and my projects because they are more or less individual. Mail Debugger is the first module which might be interested for someone else as well. https://modules.processwire.com/modules/mail-debugger/ Basically it covers two use cases: 1) Log outgoing emails 2) In debug mode mails are send to a specified email address instead of the original recipient(s) I checked the compatibility for PW 3+ because unfortunately I don't have any other version for testing currently. Feel free to drop me a comment if the module works also for older PW versions.
  5. Hi. I have a setup that sends an email to all users that have subscribed to a category. When a post i published in a category, emails needs to be sent to all those users. For instance, I have 3 user subscribed, so 3 emails should be sent. However, 6 emails are sent and some of the emails are sent to 2 and 3 person at the same time. Please see attached file for what I mean. if( $page->template == "post" && !$page->isTrash() ){ if( $page->id && $page->isChanged( 'status' ) && !$page->is( Page::statusUnpublished ) ) { $from = wire('config')->adminEmail; foreach( wire( 'users' )->find( "roles=partner, location=$page->location, branch=$page->branch" ) as $user_data ){ $mail = wireMail(); $mail->to( array( $user_data->email => $user_data->contact_name ) ); $mail->from( $from, 'My Company' ); $mail->subject( 'Hi '.$user_data->contact_name.'<br>My subject' ); $mail->bodyHTML( 'My message' ); $mail->send(); } } }
  6. Anyone happen to have created an mailchimp signup modules? Just looking into it now. Looking to create a simple module that signs people up to a list on mailchimp when a new suer is created.
  7. How should messages for Wire or $mail->send() be formatted? There is some information here; you can send text and html versions, but there are no examples how to format those. /n or /r/n etc. is ignored for the text version. What syntax should be used to get line breaks in the email? For the html version, it would be nice if you could pull that from a field. For most emails you would need to be able to insert the recipient's name and other data. PHP variables don't work in field content. Are there other ways to achieve this; replace a tag in the field body with data from php script in the template? Maybe with Hanna Code? Or is that what RuntimeMarkupField is for?
  8. I'm trying to send an email notification for each inquiry submitted. Currently they're just saved as pages. I want to email notify too. So I have (mail part is at the bottom): // check if the form was submitted if($input->post->submit) { // determine if any fields were ommitted or didn't validate foreach($required_fields as $key => $value) { if( trim($value) == '' ) { $error_message = "<p class='error'>Please check that you have completed all the required fields.</p>"; $error = true; } } // if no errors, create a new page if(!$error) { $p = new Page(); // create new page object $p->template = 'vessel_inquiry'; // set template $p->parent = wire('pages')->get('/sales/inquiries/'); // set the parent $p->name = $input->post->vessel_id . '_' . date('YmdHisu') . '_' . $input->post->user_id; $p->title = $input->post->title; // set page title (not neccessary but recommended) $p->save(); //create the page // populate fields $p->message = $input->post->message; if($user->isLoggedin()) { $p->user = $input->post->user_id; } else { $p->fullname = $input->post->fullname; $p->email = $input->post->email; } $p->vessel_id = $input->post->vessel_id; $p->status = $p->status | Page::statusLocked; $p->save(); //save the populated fields $success = true; $mail = new WireMail(); // chained method call usage $mail->to('my@email.com')->from('some@email.com')->subject('Message Subject')->body('Message Body')->send(); } This is just to test email sending period. (The to and from emails are actually different ones that I have access to.) I've tried several times to submit inquiries and am not getting anything in spam or anywhere. I'm using XAMPP on OS X. I know email is complicated and not exactly a ProcessWire matter but do you guys know how I might be able to troubleshoot or resolve this? Surely others here have experience using wireMail() on similar setups... Thanks much.
  9. Ok, so I have the following phpMailer script that works perfectly. However, I also need this to send a completely different email to the person who filled out the form with basic instructions. I am very new to phpmailer (much quicker and easier to work with). Just to lay it all out what I am trying to accomplish: On submit, the php submits the form data to myself via email, but at the same time it sends another email to the user who completed the form with instructions. Has anyone accomplished anything like this before? <?php require("class.phpmailer.php"); require_once('class.smtp.php'); $mail = new PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP $mail->SMTPAuth = true; $mail->Host = "********.****"; $mail->Port = *****; $mail->IsHTML(true); $mail->Username = "******"; $mail->Password = "**********"; $mail->From = "*******@********.com"; $mail->AddAddress("*****@****.***"); $field1= Trim(stripslashes($_POST['firstName'])); $field2= Trim(stripslashes($_POST['lastName'])); $field3= Trim(stripslashes($_POST['emailAddress'])); $field4= Trim(stripslashes($_POST['phoneNumber'])); // Email body text $mail->Subject = "First PHPMailer Message"; $mail->Body .= "First Name: $field1"; $mail->Body .= "Last Name: $field2"; $mail->Body .= "Email Address: $field3"; $mail->Body .= "Phone Number: $field4"; if(!$mail->Send()) { echo 'Message was not sent.'; echo 'Mailer error: ' . $mail->ErrorInfo . $mail->SMTPDebug = 2; } else { echo 'Message has been sent.'; } ?>
  10. I used wireMail to send website email notification to users. I found that email with asian chars, the email received by user may occur garbage text. web mail client (gmail) In gmail, show original. the text on the email raw header look good. The code I use to send email $mail = wireMail(); $mail->to($settings['paypal']['order_email_notify'])->from('noreply@mydomain.com', 'No-Reply'); $mail->subject($order->member->name.' has placed an order. Order# '.$ordernumber); $email_template = wireRenderFile("partial/email-order-notification-tpl", array('order'=>$order, 'settings'=>$settings, 'user'=>$user)); $mail->bodyHTML($email_template); $mail->send(); The partial/email-order-notification-tpl.php file <?php // This email order template is for administrator for order placement notification $out = ''; $grand_total = 0; $total = 0; $out .= "<html>"; $out .= "<head>"; $out .= "<meta charset='utf-8'>"; $out .= "<meta http-equiv='x-ua-compatible' content='ie=edge'>"; $out .= "<title>Order</title>"; $out .= "<style>"; $out .= "table {width: 500px;}"; $out .= "thead {font-weight:bold;}"; $out .= "tfoot tr td:first-child {text-align: right;}"; $out .= "tr td:last-child {text-align: right;}"; $out .= "tbody tr:nth-child(even) {background: #eee;}"; $out .= "tbody tr:nth-child(odd) {background: #ddd;}"; $out .= "thead tr {background: #6d95e0;}"; $out .= "</style>"; $out .= "</head>"; $out .= "<body>"; $out .= "<p>Dear, Admin</p>"; $out .= "<p>Member <strong>{$order->member->name}</strong> is placed an order on ".date('d-M-Y H:i:s', $order->order_time)."</p>"; $out .= "<p><strong>Member number:</strong> {$user->member_number}</p>"; $out .= "<p><strong>Member name:</strong> <span style='text-transform:uppercase'>{$user->surname}</span> {$user->given_name}</p>"; $out .= "<p><strong>Order number:</strong> {$order->title}</p>"; $out .= "<p><strong>Order date:</strong>".date('d-M-Y H:i:s', $order->order_time)."</p>"; $out .= "<p><strong>PayPal Transaction Id: </strong>{$order->paypal_transaction_id}</p>"; $out .= "<p><strong>Payment method: </strong>{$order->payment_method}</p>"; $out .= "<h3>Order details</h3>"; $out .= "<table width='100%'>"; $out .= "<thead>"; $out .= "<tr>"; $out .= "<td>Item</td>"; $out .= "<td>Qty</td>"; $out .= "<td>Price</td>"; $out .= "<td>subtotal</td>"; $out .= "</tr>"; $out .= "</thead>"; $out .= "<tbody>"; foreach($order->order_items as $item) { $p = $pages->get($item->product_id); $out .= "<tr>"; $out .= "<td>{$p->title}<br/>{$p->body}</td>"; $out .= "<td>{$item->product_quantity}</td>"; $subtotal = $item->product_price * $item->product_quantity; $total += $subtotal; $out .= "<td>{$item->product_price}</td>"; $out .= "<td>".number_format($subtotal)."</td>"; $out .= "</tr>"; $grand_total += $total; } $out .= "</tbody>"; $out .= "<tfoot>"; $out .= "<tr>"; $out .= "<td colspan=3>"; $out .= "subtotal:"; $out .= "</td>"; $out .= "<td>".number_format($total)."</td>"; $out .= "</tr>"; $out .= "<tr>"; $out .= "<td colspan=3>"; $out .= "shipping:"; $out .= "</td>"; $out .= "<td>0</td>"; $out .= "</tr>"; $out .= "<tr>"; $out .= "<td colspan=3>"; $out .= "Grand total:"; $out .= "</td>"; $out .= "<td>".number_format($grand_total)."</td>"; $out .= "</tr>"; $out .= "</tfoot>"; $out .= "</table>"; $out .= "<p><strong>"."Terms and Conditions"."</strong><br/>"; $out .= $settings['terms_and_conditions']['eng']."</p>"; $out .= "</body>"; $out .= "</html>"; echo $out;
  11. I know it is standard for a PHP setup to have a working mail() function, but I'm doing some work on a server where the local SMTP server has been disabled. While it's fairly trivial to set the SMTP server global variable to a remote server, it's impossible to setup authentication into the remote SMTP server. Therefore it would be useful to be able to hook into any functions which send email (eg forgotten password for admin login) and override it with phpMailer (or similar).
  12. Hi guys, sorry to be bugging you, was just wondering if anyone with more PHP experience may be able to see a line or two in my code which is stopping the form from working. It's essentially a working contact form that Ryan helped me with to which I'm trying to integrate PHPMailer as I was having problems receiving mail natively. Here is my code: <?php include("./header.inc"); $success_message = "<h3 class='success'>Thank you, your message has been sent.</h3>"; $success = false; // we assume it and set to true if mail sent $error = false; // set and sanitize our form field values $form = array( 'name' => $input->post->name, 'email' => $input->post->email, 'phone' => $input->post->phone, 'subject' => $input->post->subject, 'level' => $input->post->level, 'hours' => $input->post->hours, 'message' => $input->post->message ); $required_fields = array( 'name' => $input->post->name, 'email' => $input->post->email, 'subject' => $input->post->subject, 'level' => $input->post->level, ); // check if the form was submitted if($input->post->submit) { // determine if any fields were ommitted or didn't validate foreach($required_fields as $key => $value) { if( trim($value) == '' ) { $error_message = "<h3 class='error'>Please check that you have completed all the required fields.</h3>"; $error = true; } } // if no errors, email the form results if(!$error) { $to_name = "To name"; $to = "recipient@email.com"; $subject = "Contact Form Request"; $from_name = "From Name"; $from = "sender@email.com"; foreach($form as $key => $value) $message .= "$key: $value\n"; require_once("./scripts/PHPMailer/class.phpmailer.php"); require_once("./scripts/PHPMailer/class.smtp.php"); $mail = new PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP $mail->SMTPAuth = true; // enable SMTP authentication $mail->SMTPSecure = "ssl"; // sets the prefix to the servier $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server $mail->Port = 465; // set the SMTP port for the GMAIL server $mail->Username = "username"; // GMAIL username $mail->Password = "password"; // GMAIL password $mail->FromName = $from_name; $mail->From = $from; $mail->AddAddress($to, $to_name); $mail->Subject = $subject; $mail->Body = $message; $mail->Send(); if ($mail->Send()) { $success = true; } } } ?> <?php if(!$success) { ?> <?php if($error) { echo $error_message; // or pull from a PW field } ?> <p id="contact_header">If you'd like to get in touch regarding tuition, please use the form below.</p> <div id="contact_aside"> <h6>Or you can find me, here: </h6> <ul> <li>Skype: <?php echo $page->skype_name; ?></li> <li><a href="<?php echo $page->fb_url; ?>" target="_blank">Facebook</a></li> <?php if ($page->twitter_url) { echo "<li><a href='$page->twitter_url' target='_blank'>Twitter</a></li>"; } ?> </ul> </div><!-- /#contact_aside --> <div class="clear"></div><!-- /.clear --> <form action="./" method="post" id="contact_form"> <fieldset class="first"> <h6>About yourself: </h6> <label for="name">Your name: (required) </label> <input type="text" name="name" autofocus> <label for="email">Your email: (required) </label> <input type="email" name="email"> <label for="phone">Your phone number: </label> <input type="phone" name="phone"> </fieldset> <fieldset> <h6 class="mt60">Your tuition: </h6> <label for="subject">Subject: </label> <select name="subject" id="subject" /> <?php foreach ($page->subject_options as $subject) { echo "<option>$subject->subject_option</option>"; } ?> </select> <label for="level">Level: </label> <select name="level" id="level" /> <?php foreach ($page->level_options as $level) { echo "<option>$level->level_option</option>"; } ?> </select> <label for="hours">Hours per week: </label> <input type="number" min="1" max="40" value="2" name="hours"> </fieldset> <div class="clear"></div><!-- /.clear --> <fieldset class="full"> <label for="message">Additional information: </label> <textarea name="message" cols="30" rows="10"></textarea> <input type="submit" name="submit" value="submit" id="submit"> </fieldset> </form> <div class="clear"></div><!-- /.clear --> <?php } else { echo $success_message; ?> <p>Please click <a href="<?php echo $config->urls->root; ?>">here</a> if you would like to return to the homepage.</p> <?php } ?> <?php include("./footer.inc"); ?> At present when the form is submitted, the page seems to think about something for a while then the page gets reloaded exactly the same as before. Thanks in advance if you have any ideas.
  13. Don't know why but the php mail function doesn't seem to work on OSX Lion ( on my computer ). Configure Postfix for Gmail SMTP did solve it. Maybe this will be handy for someone who has the same problem.
  • Create New...