I want to have different transactional emails content depending of language. Is it possible to achieve that programatically, to create language specific content.
My website has ~50 store views/6 languages and I don't want to add separate template for every store.
UPDATE:
I don't want to translate, but to add completely different content for different languages. Random example: for all stores that use English language i want to have content "Welcome to our store", for stores that use French language i want to have content "How are you today(in French)" and so on. 95% of email content is completely the same, so i use translations for it, but the point is that i don't know how to 'fix' this 'different content' part
Use the trans directive in email templates. Make sure no spaces for variable assigment. Example:
<!-- Correct -->
{{trans "Thank you for your order from %store_name." store_name=$store.getFrontendName()}}
<!-- Incorrect -->
{{trans "Thank you for your order from %store_name." store_name = $store.getFrontendName()}}
The trans directive translate strings into the configured language for your store view. For example, if an email is being sent from a store view that is configured to use the fr_FR locale, the emails are translated to French.
Should have proper configs in the following paths:
Stores-->Configuration-->General-->General-->Locale Options
path_to_theme_directory/i18n/fr_FR.csv
Please check details on Magento's devdocs
Related
Problem :
In Gmail the email template is not viewed like
http://zurb.com/ink/downloads/templates/basic.html
it looks like a simple plain text mail with html tags, without color formatting
What I Tried :
Template Code Used : http://zurb.com/ink/downloads/templates/basic.html
Copy Pasted in Views\Layouts\Emails\html\default.ctp for a quick check & sent a test mail.
Their Test's says it should work on all major email emails
Test Result : https://litmus.com/pub/85a1b19
That is a nice layout - just not for emails.
For templates HTML emails all style must be inline - style tags are not allowed across many email clients.
Thus, you need to use something like I do to transform the style css into inline css upon sending:
https://github.com/dereuromark/tools/blob/master/Lib/InlineCssLib.php
Basically, upon generating the final template, an afterLayout() hook of a helper can trigger this.
See this discussion for details on the implementation.
Maybe the parameter ->emailFormat('text')?
ensure that you use ->emailFormat('html')
How do you go about changing the title of emails in a second language store view. Example "New Order" in the New Order confirmation email. csv files are not responding in this case...
Another solution. You can copy the default email templates into a language folder you are wanting to use, and translate them manually.
Copy everything in app/locale/en_US/template to app/locale/[YOUR
LANGUAGE CODE]/template.
Change [YOUR LANGUAGE CODE] to the Language Code of your
desired language. YOu can find a list here. Make sure it's in
the format en_US.
Modify the email templates in your app/locale/[YOUR
LANGUAGE CODE]/template folder.
In Magento, go to System > Configuration > General. At the top left, change your Current Configuration Scope: to the store you want translated.
Change the Locale to the language you translated to. It must match correct the language code used in your folder namespace.
NOTE: When editing the email template files, you'll notice some comments at the top containing variables and such. You will see something like <!--#subject Welcome, {{var customer.name}}! #-->. Changing this will alter the subject line used by Magento.
You can just create custom Transactional Emails which include the translations needed for the store view.
Create a new Transaction Email template, in your store's required
language. Go to System > Transactional Emails and click Add New
Template. Load in the default template you are trying to
translate and modify the subject and body of the email.
Go to System > Configuration > Sales Emails At the top left of your configuration, change to your desired Store View you want these emails to be assigned to.
Change the New Order Confirmation Template to the Transaction Email template you created. Click Save Config.
Items ordered from that store should now send an email using the translated email you created.
I'm using Drupal 6.16: When a user creates an account on my site I have them select a category (ie children, youth, adult, etc). This is done with the select list box using the content_profile module. I have a content type that posts an announcement. In this content type is a check box that says 'email group'. Right now it does nothing, but what I would like for it to do is e-mail all the users that are associated with the group they chose when signing up for their account. If this will require extra code please be specific as I am not a strong php programmer.
Thanks for the help!!
msindle
There might be some module that do it exactly, but I don't think so.
I would have done it using few building blocks:
Retrieve the list of emails using Views - define a view that gives you the addresses according to a given group argument.
Use Rules module that will send an email notification after node is created.
Combine the two (this is the hard part) - insert the values from the view as the recipients for the email. You might be able to do it using PHP inside the Rule definition, plus view execution.
Try to accomplish it, and if you get into troubles, you are welcome to contact me via shushu.i#gmail.com
I would try http://drupal.org/project/subscriptions module + http://drupal.org/project/messaging module. You can set preferences for automatic subscribing to content type. Maybe Rules module can subscribe users automatically after creating or updating content_profile. Or maybe Rules can flag users after creating or updating content_profile and Subscription module could autosubscribe flagged users.
I am trying to embed an ID into an email so that when a recipient replies to an email that my system sends out, my system can pick it up and match the two together.
I have tried appending a custom header, however this is stripped out when the user replies.
I have tried embedding an HTML comment within the email, but outlook does not seem to keep comments when a reply email is created.
Worst case scenario, I can manually try and match the sent and received emails by time span or have a visible tag within the message body.
Does anyone know of a more elegant solution?
Thanks in advance
Email messages already contain such an identifiers, called Message-ID. And there's even a way to send which message you're replying to by sending that ID in a header called In-Reply-To. That's done by pretty much all email clients, that's how they usually do their threading.
It's defined in RFC 822 (yep that's pretty old) and probably re-defined and refined in more modern versions of that.
I have seen a method that includes a one byte image with a unique name that's linked to the user. When they view the email and download the images, your HTTP server will record a hit for that unique image. Of course the user needs to display images, but you can include a message in the body asking them to display the images. We actually include content in an image so they need to show images.
If your incoming e-mail can handle +foo or -foo suffixes, use that.
Many e-mail systems can route user+foo#example.com or user-foo#example.com
to user#example.com. You can replace foo with some kind of identifier.
Several mailing list servers use this for tracking bounces.
While I can't say for certain, my investigation in that sort of matter some time ago yielded the following "conclusion":
Headers are transformed a lot
Message bodies are transformed a lot
This is partly because, I suspect, of:
Need to protect users from malicious intentions
Need to perform "targeted marketing"
I have seen "unique codes" flying around in clear text in the email body but I would suggest having a unique identifier embedded in the return address instead.
The usual approach is to place the id in the subject line and/or somewhere visible in the message text and informing the recipient that he should not modify the subject or quote the original mail when responding.
What techniques are available for sending an email via a webpage or a form on a webpage?
I've got some background idea that you POST the form data to a script but I've don't really know what a cgi script is (I'd love to learn if this is the suggested method!) or what the current practice is.
This is just to provide some way for users to contact the operators. The in-page form seems like it would be easier on the user than ask them to open their mail client. I was also concerned about bots harvesting the contact email address (in the case of mailto: links).
When you submit a form, the data in that form gets sent to the server-side script. For example, in PHP you access that data with the $_POST array, the <input name=""> becomes the arrays index.. For example..
// <form action="mailer.php">[..]<input name="subject" [..]><input name="content" [..]></form>
echo("The subject is: ". $_POST['subject']);
echo("The content is:" . $_POST['content']);
At the most basic level, all you have to do is use your programming languages built in mail function. Again, in PHP this is simple mail():
mail($to, $subject, $message);
You would just set $to to your email address (Do not allow the user to set this, or they are able to send mail as "you", to anyone - "spam"..), $subject and $message would be set form $_POST[]
Before you go any have a HTML file that goes to a script with mail("me#example.com", $_POST['subject'], $_POST['content']);, think what would happen if someone reloaded that page 200 times.. You must have some kind of security in it, probably a captcha, and/or rate-limiting.
One thing, that has bugged me before - remember a "contact us form" is not a replacement for giving an actual email address! For example, my mail client keeps a copy of all mail I send, and I can attach files, and it's much nicer writing in a familiar mail client than a form <textarea> (especially when the I accidently hit "back" and the form decides to clear itself)!
For most unix/bsd/linux systems, most languages provide a programmatic wrapper around the Mail command.
If you are using the ASP.NET 2.0, you can use the System.Net.Mail namespace.
More information here
todays languages for web development usually have libraries for sending e-mail. it depends which language you use, but you'd find it in your language's docs. it's pretty simple, the library inside your language usually encapsulates and provides 'smtp client' behavior which you use. you provide mail message with sender and recipient, and the data for connecting to your SMTP server.
or, you sometimes may use the SMTP capabilities on the machine where your web server is, if those are available. i'm not sure whether it gets worse for the e-mail at the recipient server because your server might not be recognized as mail server for the domain... someone with more experience might comment on that.
Well, here's what not to do:
Please spam me, kthx
It is a better code pattern to have users submit a form, sanitize the input and format it however you see fit, and then pass the data to a mail function in your language of choice.
Sending mail should be done server-side - the specifics change according to your server-side language, your operating system, and what access your server has to an SMTP server.
If you're looking for a lightweight way to add a contact form to a blog or public website, try Wufoo - you can add a contact form that will send you email very easily (up to 3 forms for free). I am not affiliated with them, I just think they're cool.