Centralised mailto email link - email

Is there a way to centralise a typical mailto html string so that the email address can be updated once instead of multiple times across the pages themselves?
Send Mail

Using PHP with $_SESSION you can have a $mail variable set that you spread trough all your webpages.
Example :
index.php
<?php
session_start();
$_SESSION["mail"]=YOUR_MAIL_ADDRESS;
?>
...
Send Mail
PageX.php
<?php
session_start();
<a href="mailto:<?php echo $_SESSION["mail"] ?>?Subject=Hello%20again"
Make just sure that you call this on the top of every pages you want to use this variable.
<?php
session_start();
You can read more here :
http://php.net/manual/fr/reserved.variables.session.php

Related

Magento2 get the product URL in invoice mail

I want to make the items clickable in the transactional mails. I modified the order mail (items/default.phtml) and added the following code:
<?php $_item = $block->getItem() ?>
<?= $block->escapeHtml($_item->getName()) ?>
However when I add the same code to the invoice mail (items/default.phtml) the value of getProductUrl() is empty.
How can I access the product URL in the invoice?
Thanks in advance.
Try this
$product_url= $_item->getOrderItem()->getProduct()->getProductUrl();
<p class="product-name"><?= $block->escapeHtml($_item->getName()) ?></p>

How to send HTML emails with unscrubscribe functionality

My website is able to send emails to people. Now what I would like to do next is be able to send HTML emails to people who subscribe to my mailing just like I would any other normal email and should they want to unscrubscribe, there is a link to do so. I've read up on mail chimp etc but all I want is to send the HTML emails like I would normal emails. Please any guidance would be useful.
With simple HTML you can't send emails, you need PHP or any other Server-Side programming language
Example of HTML email sending with PHP:
<?php
$to = "PUT_RECIPIENT_EMAIL_ADDRESS_HERE";
$subject = "PUT_SUBJECT_HERE";
$mail_body = '<html>
<body bgcolor="#573A28" topmargin="25">
Put HTML content here with variables from PHP if you like
Variable display Example: ' . $subject . '
</body>
</html>';
$headers = "From:youremail#yoursite.comrn";
$headers .= "Content-type: text/htmlrn";
mail($to, $subject, $mail_body, $headers);
?>
to use email subscription you need a table in your database wich stores emails who subscribed to your newsletter, if a user hits "unsubscribe" you have to execute a MySQL query to remove it from your database:
table: subscribed_users(email)
SQL code to add new users to the newsletter:
INSERT INTO subscribed_users VALUES 'put_email_to_subscribe_here'
SQL code to remove users from the newsletter:
DELETE FROM subscribed_users WHERE email = 'put_email_to_unsubscribe_here'
Of course if you don't know how to use php or mysql, you need to study this two languages in order to do your newsletter subscribing.
If you don't want to learn php and mysql you can watch this page, there are some scripts that may help you, but i think you have to learn at least php in order to use them:
http://www.phpkode.com/projects/category/php-newsletter/

Wordpress: Static pages, but one page with posts and one with contact form

I have set up a fresh custom template from the scratch for wordpress with only six static pages.
Now, I have two questions/problems:
How do I put up posts (without comments) on one of those pages? The aim is, that five pages are just giving out static content, but only one of those pages should be showing posts like a little diary/blog within an otherwise static website. Right now with the given code (see below) all six pages give out just the static content from "pages" within Wordpress, which is okay, but I just can not figure out, how to put the posts on one single pages of those six.
How can I add a conctact form on one of those static pages? I mean, they are all getting the same input over my index.php or pages.php, but where do I set the PHP code for the contact form and how do I insert it to just one of those pages (for example CONTACT)?
Here is my code up to now:
index.php
<?php get_header(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post();?>
<?php the_content(); ?>
<?php endwhile; endif; ?>
<?php get_footer(); ?>
page.php
<?php get_header(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post();?>
<?php the_content(); ?>
<?php endwhile; endif; ?>
<?php get_footer(); ?>
Thank you in advance.
To clear things up:
Problem 1:
I have a static website in wordpress with six pages (see www.studio-scs.de, if that helps) and those six pages load the content of the pages throughout page.php, of course.
My problem is now, I need ONE of those six pages (for example TERMINE) to show POSTS, while the other six are still showing NO POSTS, but the PAGE content.
But how can I do that, if all links/pages refer to page.php, which has the code to just state PAGE content without POSTS (see above)?
Problem 2:
On one of the other five pages I want to add a contact form, which needs some PHP code in the header, of course.
But how and where do I insert that, if all pages are loaded by page.php with the same code? Do I have to enter that into header.php and just leave it there loaded all the time/pages?
For your First problem create a new Template and put POST function there and add that template in Dashboard-->pages--> right hand side-->Template and choose template from drop down.
e ius
For Problem 2
Add your PHP code to HEADER.php once, that call each time and display only specific page, where it requried.
Excaly i am not getting your point, how ever i think you want to add post and contact form7 on same page.
Then use this code.
<?php /* Template Name:ABC*/ ?>
<?php get_header(); ?>
<?php
global $post;
$args = array( 'numberposts' => LIMIT OF POST, 'category' => CATEGORY ID );
$myposts = get_posts( $args );
foreach( $myposts as $post ) :
setup_postdata($post); ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php endforeach; ?>
<!--Contact Form Start Here-->
<?php echo do_shortcode('[CONTACT FORM SHOT CODE HERE]'); ?>
<!--Contact Form END Here-->
<?php get_sidebar();
get_footer();
?>

HTML format for joomla sendmail

I want to change the joomla plain text email format to HTML format, so when user get email from my joomla site will receive a nice looking html formated email. Anybody can assist me how to do this? Any core hack would be OK. Thanks
here is what u need to do, there is flat that tells joomla mailer that content is in html
jimport('joomla.mail.mail');
$user = JFactory::getUser();
$user_email = $user->email;
$mailer = JMail::getInstance();
$mailer->setSender('no-replay');
$mailer->addRecipient($user_email);
$mailer->isHTML(TRUE); <--- here is flag
$mailer->setSubject('subject');
$html= array();
$html[] = '<div style="background: red"> hello world</div>';
$mailer->setBody(implode("\n", $html));
$mailer->Send();
If you are referring to the Mass Mail system in the Joomla backend, then there is an option saying "send in HTML mode". Else I would recommend using a different component.

Zend Famework how to set action for a form (to validate on the same page) that appears in all pages

I have a form (login form) that appears in all pages (if the user is not logged in).
The form is created from view helper and then directly called in layout.phtml
class Zend_View_Helper_LoginForm extends Zend_View_Helper_Abstract
{
public function loginForm()
{
$login = new Application_Form_Login();
return $login;
}
}
<?php if(!$this->isLoggedIn()): ?>
<div id="login">
New User? Register Here
<?php echo $this->loginForm(); ?>
Forgot Password!
</div>
<?php endif; ?>
Now how to set the action of this form such that i could validate the fields in the same page?
Matthew Weier O'Phinney (the ZF Programmer leader ) has a blogpost about creating your reusable widget exactly like your needs
you should try it ,
http://weierophinney.net/matthew/archives/246-Using-Action-Helpers-To-Implement-Re-Usable-Widgets.html
You can validate it on other page and redirect back after validation. Also, you can validate it through ajax.
What we usually do is that we send the form to different action and have dedicated form rendered in that actions view. If there is no error, user is redirected without noticing. If there is an error, the form is dispalyed in main content area with proper error messages. Usualy the problem is that the area of this form vidget is not big enough for good error message.
usually you post it to login page and if you fail you can redirect user back, set proper http header and display a error message