php mailer subject utf8 - utf-8

my mail form works very well. there is only problem in the subject line. If there is the letter "şğüöç" in the mail, the subject line is empty. It shows like this in MS Outlook program. =? Utf-8? Q ?? =
If there are no letters "şğüöç", the subject line is correct. I have read many articles. but i couldn't my head hurts, my brain burned.
<?php
require ("class.phpmailer.php");
$gittiMesaji = " ";
if(isset($_POST['submit'])){
$isimsoyisim =$_POST['isimsoyisim'];
$telefon =$_POST['telefon'];
$email =$_POST['email'];
$dogumtarihi =$_POST['dogumtarihi'];
$tckimlik =$_POST['tckimlik'];
$yabanci =$_POST['yabanci'];
$dogumyeri =$_POST['dogumyeri'];
$askerlik =$_POST['askerlik'];
$ehliyet =$_POST['ehliyet'];
$medeni =$_POST['medeni'];
$evlenmetarih =$_POST['evlenmetarih'];
$esbilgileri =$_POST['esbilgileri'];
$cocuk =$_POST['cocuk'];
$ikamet =$_POST['ikamet'];
$sabika =$_POST['sabika'];
$temas =$_POST['temas'];
$okul1 =$_POST['okul1'];
$okul1sehir1 =$_POST['okul1sehir1'];
$okul1mezuniyettarih1 =$_POST['okul1mezuniyettarih1'];
$okul2 =$_POST['okul2'];
$okul2sehir2 =$_POST['okul2sehir2'];
$okul2mezuniyettarih2 =$_POST['okul2mezuniyettarih2'];
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = 'smtp.yandex.com';
$mail->SMTPAuth = true;
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->Username = 'no-reply#xxxxxxxxx.com';
$mail->Password = '**********';
$mail->CharSet = 'utf-8';
$mail->Encoding = 'base64';
$mail->From = 'no-reply#xxxxxxxxx.com';
$mail->FromName = 'Saffan Global';
$mail->AddAddress ($email);
$mail->AddCC ('webmaster#xxxxxxxxx.com');
$mail->IsHTML(true);
$mail->Subject = 'Basvuru - ' .$isimsoyisim;
// HTML Message Starts here
$mail->Body = "
<html>
<body>
<table style='width:90%' align='center';>
<tbody>

Related

Google Cloud Speech to Text no output

Can't figure out why there is no output from this request. I loaded a 44100hz mp3 into this. It just outputs an empty object through dd(). I don't think its anything to do with the credentials. As iv enabled the API from the Google Cloud Console.
$speech = new SpeechClient([
'credentials' => storage_path("app/compute/google/cloud/service_accounts/keys/key1.json"),
]);
$file = file_get_contents($options["input_url"]);
// change these variables if necessary
$encoding = AudioEncoding::LINEAR16;
$sampleRateHertz = 44100;
$languageCode = 'en-US';
// get contents of a file into a string
// set string as audio content
$audio = (new RecognitionAudio())
->setContent($file);
// set config
$config = (new RecognitionConfig())
->setEncoding($encoding)
->setSampleRateHertz($sampleRateHertz)
->setLanguageCode($languageCode);
$response = $speech->recognize($config, $audio);
dd(($response->serializeToJsonString()));
foreach ($response->getResults() as $result) {
$alternatives = $result->getAlternatives();
$mostLikely = $alternatives[0];
$transcript = $mostLikely->getTranscript();
$confidence = $mostLikely->getConfidence();
$this->info('Transcript: %s' . PHP_EOL, $transcript);
$this->info('Confidence: %s' . PHP_EOL, $confidence);
}
}

save smtp sent mail in outlook sent folder using outlook add in

I would like to send smtp send mail from outlook-addin that mail save into outlook sent folder
Note: Save mail item in sent folder from address must be which i specified smtp from address not outlook login username.
public bool SendEMail()
{
MailMessage mailNew = new MailMessage();
var smtp = new SmtpClient("SmtpServer")
{
EnableSsl = false,
DeliveryMethod = SmtpDeliveryMethod.Network
};
smtp.Port = 587;
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.UseDefaultCredentials = false;
System.Net.NetworkCredential credentials =
new System.Net.NetworkCredential("UserName", "password");
smtp.EnableSsl = false;
smtp.Credentials = credentials;
MailAddress mailFrom = new MailAddress("clark#gmail.com");
mailNew.From = mailFrom;
mailNew.To.Add("someone#gmail.com");
mailNew.Subject = Subject;
mailNew.IsBodyHtml = Html;
mailNew.Body = Body;
smtp.Send(mailNew);
return true;
}
thanks in advance
You will need to create a sent item in the Sent Items folder and set all the relevant properties using MailItem.PropertyAccessor. Note that PropertyAccessor will not let you set some sender related properties. In Outlook 2010 or higher you can set the MailItem.Sender property.
Also note that the sent flag cannot be changed after the message is saved, so to create a sent item using OOM, you will need to create a post item, then change its MessageClass property to "IPM.Note".
Also note that ReceivedTime and SentOn properties are reset by OOM every time the message is saved.
If using Redemption is an option (I am its author), you can do something like the following (off the top of my head):
Redemption.RDOSession session = new Redemption.RDOSession();
session.MAPIOBJECT = Application.Session.MAPIOBJECT;
Redemption.RDOMail message = session.GetDefaultFolder(rdoDefaultFolders.olFolderSentMail).Items.Add("IPM.Note");
message.Sent = true;
message.Subject = "test";
message.Body = "fake sent message";
message.Recipients.AddEx("The Recipient", "recipient#domain.com", "SMTP", olTo);
string senderEntryID = session.AddressBook.CreateOneOffEntryID("Some Name", "SMTP", "user#domain.com", false, true);
addressEntry = session.AddressBook.GetAddressEntryFromID(senderEntryID);
message.Sender = addressEntry;
message.SentOnBehalfOf = addressEntry;
message.Save();

codeigniter A Database Error Occurred

Can someone help me?
I am a beginner and trying to make wearing CodeIgniter authentication, but when I try to make an error like this
A Database Error Occurred
Error Number: 1046
No database selected
SELECT * FROM (`user`) WHERE `user_username` = 'amanda' AND user_passwordMD5("12345") =
Filename: C:\xampp\htdocs\codeigniter\system\database\DB_driver.php
Line Number: 330
thanx
please make sure you have setup database configuration in application/config/database.php file
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = 'my_database';
Check the database.php file in application/config/
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = 'mypassword';
$db['default']['database'] = 'my_database'; // here is the database selection
Open the file application/config/database.php file and change the following line:
$db['default']['dbdriver'] = 'mysql';
To:
$db['default']['dbdriver'] = 'mysqli';
This shift to mysqli saved by day.
Lost connection to MySQL server during query
Line Number: 337
people who critic here should have not only education but also common sense. they should know also what time I made this comment and what was my reputation score. It is not only about giving an answer but the giving also the suggestion a beginner can pin-point the problem. I could have given the answer but just after posting my comment someone already given answer. Look below - best among anyone given here
$config['hostname'] = "localhost";
$config['username'] = "username";
$config['password'] = "password";
$config['database'] = "database";
$config['dbdriver'] = "mysql";
$config['dbprefix'] = "";
$config['pconnect'] = FALSE;
$config['db_debug'] = TRUE;
$config['cache_on'] = FALSE;
$config['cachedir'] = "";
$config['char_set'] = "utf8";
$config['dbcollat'] = "utf8_general_ci";

SESSION varibales are not displayed after redirection used with memcache

I have a page session_config.php in that page I have following code
session_name('session_sw');
session_start();
$session_ID = session_id();
I have another page index.php in which I am including session_config.php ,the code as follows.
$email = $_REQUEST['email'];
$pass = $_REQUEST['pass'];
$error = 0;
if(!empty($email) && !empty($pass)) {
$url = "$SERVER/sw/apis/3rdpartylogin.php?advertiser_login=1&pass=$pass&email=$email";
$resp = file_get_contents($url);// it sends json encoded string.
$resp = json_decode($resp);
if ( $resp->status == 'success' ) {
if ( !isset($resp->mesg->profile) || $resp->mesg->profile == 0 ){
$error = '1';
} else {
include "session_config.php";
$_SESSION['user_id'] = $resp->mesg->user_id;
$_SESSION['customer_id'] = $resp->mesg->customer_id;
$_SESSION['customer_name'] = $resp->mesg->customer_name;
$_SESSION['logged_in_user_email'] = $_REQUEST['email'];
$_SESSION['agency_name'] = $resp->mesg->agency_name;
$_SESSION['profile'] = $resp->mesg->profile;
$_SESSION['metadata'] = $resp->mesg->metadata;
$_SESSION['show_archival'] = $resp->mesg->show_archival;
$_SESSION['show_live'] = $resp->mesg->show_live;
$_SESSION['show_sov'] = $resp->mesg->show_sov;
$_SESSION[$session_ID]['session_name'] = 'surewaves_agency_view';
header("Location: reach.php");exit;
}
} else {
$error = '1';
}
}
?>
// Here I am able fetch the correct data in '$resp' variable and also it is redirecting to reach.php
In reach.php , i have following code
<?php
include "session_config.php";
echo "<pre>";
print_r($_SESSION);exit;
?>
But in reach.php when I am fetching the session variables the session array is showing completely empty like this Array (). WHY?
I am using memcache for it and we are using ubuntu.
In My php.ini i have included following code..
extension = memcache.so;
session.save_handler = memcache
session.save_path = "http://localhost:11211"
I have also tried with "tcp ://localhost:11211" but nothing worked.
Try to remove the http:// part from session.save_path and replace localhost with 127.0.0.1:
session.save_path = "127.0.0.1:11211"
Take a look at the second example at http://br1.php.net/manual/en/memcache.examples-overview.php.

Twitter API - saving OAuth token in session

I am trying to find a way to keep connected with the Twitter API once authorised using OAuth but am having problems.
I get "Invalid / expired Token" when trying to connect to Twitter API using a saved Oauth token in a session or database.
Is there a way to do this? I dont want the users of my App to have to login via Twitter every time. Surely once they have authorised my App once, that should be enough?
$consumer_key = 'consumerkey';
$consumer_secret = 'consumersecret';
$twitterObj = new EpiTwitter($consumer_key, $consumer_secret);
if (isset($_GET['oauth_token'])){
$oauth_token = $_GET['oauth_token'];
} else if ($_SESSION['oauth_token']){
$oauth_token = $_SESSION['oauth_token'];
echo $_SESSION['oauth_token'];
} else {
//see if authorisation already set up in DB
$query = mysql_query("SELECT oauth_token FROM PingSocialMediaUsers WHERE oauth_provider = 'twitter' AND clientID = '$clientID'");
$result = mysql_fetch_row($query);
$oauth_token = $result[0];
}
if($oauth_token == ''){
$url = $twitterObj->getAuthorizationUrl();
$twitter_login = $url;
} else {
$twitterObj->setToken($oauth_token);
$token = $twitterObj->getAccessToken();
$twitterObj->setToken($token->oauth_token, $token->oauth_token_secret);
$_SESSION['oauth_token'] = $token->oauth_token;
$_SESSION['oauth_secret'] = $token->oauth_token_secret;
$twitterInfo= $twitterObj->get_accountVerify_credentials();
$twitterInfo->response;
echo $twitterInfo->response['error'];
//echo '<pre>';
//print_r($twitterInfo);
$id = $twitterInfo->id;
$username = $twitterInfo->screen_name;
//add to details database
//find the user by ID
if ($id != ''){
$query = mysql_query("SELECT * FROM PingSocialMediaUsers WHERE oauth_provider = 'twitter' AND oauth_uid = '$id'");
$result = mysql_fetch_array($query);
// If does not exist add to database
if(empty($result)){
$query = mysql_query("INSERT INTO PingSocialMediaUsers (oauth_provider, oauth_uid, username, oauth_token, oauth_secret) VALUES ('twitter', {$id}, '{$username}', '{$_SESSION['oauth_token']}', '{$_SESSION['oauth_secret']}')");
$query = mysql_query("SELECT * FROM PingSocialMediaUsers WHERE id = " . mysql_insert_id());
$result = mysql_fetch_array($query);
} else {
//update the tokens
$query = mysql_query("UPDATE PingSocialMediaUsers SET oauth_token = '{$_SESSION['oauth_token']}', oauth_secret = '{$_SESSION['oauth_secret']}' WHERE oauth_provider = 'twitter' AND oauth_uid = {$id}");
}
$_SESSION['id'] = $result['id'];
$_SESSION['username'] = $result['username'];
$_SESSION['oauth_uid'] = $result['oauth_uid'];
$_SESSION['oauth_provider'] = $result['oauth_provider'];
$_SESSION['oauth_token'] = $result['oauth_token'];
$_SESSION['oauth_secret'] = $result['oauth_secret'];
}
$twitterAuth = TRUE;
}
I believe you are talking about access_token which you will get from the twitter as last part of OAuth handshaking after which you can go to access there services on user behalf.
Here is what they are saying in there official developer page
We do not currently expire access tokens.
Your access token will be invalid if a user explicitly
rejects your application from their settings or if a Twitter admin suspends
your application. If your application is suspended there will be
a note on your application page saying that it has been suspended.
So you can very well store that token in your database and can always use at later stage.
here is the reference to there API page
Twitter OAuth FAQ
So i suggest you to make sure that you are not changing any application setting and you are getting a valid access_token from session/database

Resources