Net.Mail.MailAddress and adding an email address to established variable - powershell

If I go
[Net.Mail.MailAddress]$email = 'mytest#domain.com'
Then later in my code I want to add an address. I can't figure out how to add an additional email address.
I have tried
[Net.Mail.MailAddress]$email = $($email,newemail#domain.com)
[Net.Mail.MailAddress]$email = $($email,"newemail#domain.com")
[Net.Mail.MailAddress]$email = "$email,newemail#domain.com"
[Net.Mail.MailAddress]$email = "$email","newemail#domain.com"

It was as simple as
[Net.Mail.MailAddress]$email = 'mytest#domain.com'
[Net.Mail.MailAddress[]]$email = 'mytest#domain.com','newaddress#domain.com'
It should be noted that I read about $Message.To.Add($email2) given in the comments but was not sure how to get that going in my code or get it going at all :)
Thanks
TheMadTechnician
and
Santiago Squarzon

Related

Set item email field in Podio

I'm having a hard time trying to guess how to set the item email field value, since there is nothing about this in the documentation (http://podio.github.io/podio-php/fields/)
I have tried :
$item->fields['email']->values = array("type"=>"work","value"=>"a#a.com");
$item->fields['email']->values = array("value"=>"a#a.com");
$item->fields['email']->values = "a#a.com";
$item->fields[$field_id]->value ="i#i.com";
$item->fields[$field_id]->type ="work";
$item->save();
Nothing works, please help! Thank you!
I have figured it out , here is the code that works (if anyone runs into the same problem)
$field_id = 'email';
$emails=$item->fields[$field_id]->values;
$item->fields[$field_id]->values =array('value'=>"i#oooo.com",'type'=>'work');
$item->save();

Adding placeholder text to Drupal 7 user_register_form

So I can get the email and username field to work just fine.
here is the code
if ( TRUE === in_array( $form_id, array('user_register_form'))) {
$form['account']['name']['#attributes']['placeholder'] = t(' Username ');
$form['account']['name']['#title_display'] = "invisible";
$form['account']['mail']['#attributes']['placeholder'] = t(' Your Email ');
$form['account']['mail']['#title_display'] = "invisible";
}
This works fine. But it seems the person who set this up is using custom field in the form because the it shows:
name="profile_installer_contractor[field_installer_first_name][und][0][value]"
How can I get these fields to show the placeholder text? I have tried:
$form['account']['field_installer_first_name'][und][0]['value']['#attributes']['placeholder'] = t(' First Name ');
but that doesn't seem to work. Any help is greatly appreciated.
Thanks,
Kevin
nevermind I figured it out on my own.
$form[profile_installer_contractor]['field_installer_first_name'][und][0]['value']['#attributes']['placeholder'] = t(' First Name ');
this worked

PHPMailer AltBody is not working

PHPMailer Version 5.2.7
$mailerObject = new PHPMailer;
$mailerObject->CharSet = 'UTF-8';
$mailerObject->IsSMTP();
$mailerObject->Host = 'dsfdf.sdfsdf.com';
$mailerObject->SMTPAuth = TRUE;
$mailerObject->Username = 'dfgdfg';
$mailerObject->Password = 'dfgdfgdfg';
$mailerObject->SMTPSecure = 'tls';
$mailerObject->WordWrap = 60;
$mailerObject->From = 'alex#test.de';
$mailerObject->FromName = 'test.de';
$mailerObject->AltBody = $bodyTextTemp;
$mailerObject->MsgHTML($bodyHtmlTemp);
I am sending an HTML-Mail and an Text-Mail. In Thunderbird in HTML-Mode HTML is correctly shown. In Text-Mode you cant see the Text-Content ($bodyTextTemp), but the HTML-Content ($bodyHtmlTemp) where all HTML-Tags were removed (looks very ugly...).
Looking to the Mail-source, I can see that the AltBody wasnt send.
Why PHPMail dont accept my AltBody?
Because msgHTML overwrites AltBody. If you want to set Body and AltBody yourself, just set them. msgHTML is a convenience function to do several things for you, but you don't need to use it. If you want to use it but also set AltBody, just set it after you call msgHTML.

typoscript assign page:id to plugin attribute

so all I actually want to do is something like
plugin.tx_felogin_pi1.redirectPageLogin = page:id
where the page:id is the PID of the current page. replacing 'page:id' with a number works as expected BUT I do need the PID instead of a fixed number. any hints are welcome
redirectPageLogin has to be a single int value:
$redirect_url[] = $this->pi_getPageLink(intval($this->conf['redirectPageLogin']));
Alternative: use as $redirMethod: getpost or referer
I think that'll fit four you.
Try
plugin.tx_felogin_pi1.redirectPageLogin = TSFE:id
or
plugin.tx_felogin_pi1.redirectPageLogin = {TSFE:id}
or
plugin.tx_felogin_pi1.redirectPageLogin.cObject = TEXT
plugin.tx_felogin_pi1.redirectPageLogin.cObject.insertData = 1
plugin.tx_felogin_pi1.redirectPageLogin.cObject.value = {TSFE:id}

preg_replace troubles

I am struggling with this regular expression.
$glossary_search[] = "/(^|>|\\s)".$glossary["glossary_name"]."($|<|\\s)/i";
$glossary_replace[] = "\$1<a href='/jargon-buster/".tapestry_hyphenate($glossary["glossary_name"]).".html' title='".$glossary["glossary_name"]."' target='_blank'>".$glossary["glossary_name"]."</a>\$2";
return preg_replace($glossary_search,$glossary_replace,$text);
I am trying to replace words in a product description with a hyperlink. The code above works if the word has a space either side but does not work if it has a full stop, comma or "<". Can anyone spot my mistake?
Thanks,
Simon
I think you might need to use preg_quote and htmlentities?
$glossary_search[] = "/(^|>|\\s)".preg_quote(htmlentities($glossary["glossary_name"],ENT_COMPAT,'UTF8'))."($|<|\\s)/i";
$glossary_replace[] = "\$1<a href='/jargon-buster/".tapestry_hyphenate($glossary["glossary_name"]).".html' title='".$glossary["glossary_name"]."' target='_blank'>".$glossary["glossary_name"]."</a>\$2";
return preg_replace($glossary_search,$glossary_replace,$text);