How to Send email programatically Prestashop? - prestashop

Hello i am trying to send email in prestashop in module
but its not working.
Is their any way to do this ?

You should check Mail class and Send method.
Example:
Mail::Send(
(int) $this->context->language->id,
$this->getTemplate(),
$this->getSubject(),
$this->getTemplateVars(),
$this->getTo(),
$this->getToName(),
$this->getFrom(),
$this->getFromName(),
$this->getFileAttachment(),
$this->isModeSmtp(),
$this->getTemplatePath(),
$this->isDie(),
(int) $this->context->shop->id,
$this->getBcc(),
$this->getReplyTo()
);
You have more examples in entire system. Just search for "Mail::Send" in code.

Related

Prestashop 1.7.7 E-Mail Input Validation for Domain Name

i looking for a solution in Prestashop for correct E-Mail Input field format validation.
A normal email xyz#domain.com will check for the # symbol but not for domain dot(!) com.
So i can write into the checkout email field as guest: xyz#domain but the dot and com missing.
Somebody have some idea for that?
Thanks
Akos
The email validity check is handled in /classes/Validate.php
into the
public static function isEmail($email)
{
}
method.
You can consider editing or overriding it to suit your needs.

Getting a contact by email using the sendgrid api

I'm trying to retrieve contact id by email using the sendgrid 'Contacts API'. It looks like the way to do this is to POST to the /marketing/contacts/search endpoint.
I'm not familiar with SQL, does anybody know how I'd query the email field as explained here:
https://sendgrid.api-docs.io/v3.0/contacts/search-contacts
on the link that you provide there is a tab that is called "try it out" click there and you can try it out. Just add your Api token and there is already a query that you just need to add the email address
{
"query": "email LIKE 'ENTER_COMPLETE_OR_PARTIAL_EMAIL_ADDRESS_HERE'"
}
if you are adding a partial email address just add % before or/and after (depending which side is missing info)

Swift Mailer in Yii Configuration

I want to send email with swift Mailer,
but i don't want to send only one email.
I want to send form data from my member model.
so how can i config this?
->setTo(array('recipient#example.com' => 'Recipient Name'))
I am using Yii 1.1.6
Try this
$email = Email::model()->findByPk(1);
and
->setTo(array($email->email => $email->name))
You can load all members and using php foreach() and send email to each user separatly. In Yii2 there is also possibility to use model(object) like array
foreach($this->getMembers()->each() as $member){
...
->setTo($member->email)
...
}

Editing BuddyPress email body link in the user activation email link

How can I edit the [wordpress#example.com] shown as part of title email of user registration? I want to edit the [wordpess#example.com] to a custom one by removing the "wordpress".
Thanks for your kind effort.
Regards
It's a WordPress related thing, not actually a BuddyPress. So below is the code for that:
add_filter( 'wp_mail_from', 'change_mail_from');
function change_mail_from($from_email){
$from_email = 'support#example.com';
return $from_email;
}
add_filter( 'wp_mail_from_name', 'change_mail_from_name');
function change_mail_from_name($from_name){
$from_name = 'Support Team';
return $from_name;
}
Just modify $from_email and $from_name variable according to your needs and insert in either your plugin or functions.php of a theme.

How to implement contacts/email address picker like in Apple's mail application?

when sending a mail on the iPhone/iPad you start typing the name of the recipient and list of proposals shows up. Either pick one from those, or continue typing an email address. Adding a new address turns the first one entered into a blue button like thing.
I would like to use this to allow users to select a couple of email addresses. Does anybody know if it is a standard component?
René
I dont really know if it is a standar UI control but i guess you could figure out something with the help of this video, this one uses the UI Person picker to display the persons name
http://www.alexyork.net/blog/post/Selecting-a-contact-from-the-Address-Book-with-MonoTouch.aspx
and with some modifications you could search on contact list and display a modal view with suggestions of the emails in the list
with this example you can get all the emails in the contact list
ABAddressBook ab = new ABAddressBook();
ABMutableMultiValue<string> emails = new ABMutableStringMultiValue();
foreach (ABPerson person in ab) {
ABMultiValue<string> personemails = person.GetEmails();
foreach (ABMultiValueEntry<string> item in personemails) {
emails.Add(item.Value, item.Label);
}
}
With this code you will get all the emails on the contact list in the variable "emails" now you just need to access the "emails" variable and look for the email the user is typing.
Hope this helps.
Alex