I need set sender name, but I have errors when I used this:
$mail=new \google\appengine\api\mail\Message();
$mail->setSender("Sender Name <email#address.com>");
same problem, if I tried modify headers:
$mail->addHeader("From", "Sender Name <email#address.com>");
Somebody who solved this problem?
Thanks
This is a known issue in GAE PHP, you can track it at https://code.google.com/p/googleappengine/issues/detail?id=10153
Related
a few days a go we received a email from sendgrid stating they are going to change some behaviors in their API, I've done research but I have not found concretly what they are refering to, currently we are using the PHP API, and atleast for the 2) I think we are OK as we use SendGrid classes to build the emails
Check your code that uses the mail send endpoint and ensure that the
“enable” parameter is included under the filter when applicable.
What do you need to do?
To avoid disruption to your mail send service, please be sure to make
the following actions before August 10, 2021
Check your code that uses the mail send endpoint and ensure that the
“enable” parameter is included under the filter when applicable.
Check your mail send header to ensure that you are using just one
X-SMTPAPI header and address header of the same kind. Remove multiple
headers of the same kind, so you have only 1 header of the same kind.
For example, if you are currently using multiple “from” headers, you
should modify your code so that you have a single “from” header.
Check your code to ensure that you are not applying any
personalization block substitution to your custom argument fields.
But what about the third item? we have substitions of following fashion: $mail->personalization[0]->addSubstitution('%url%', $link);
But I havent found anything like a "block sustitution in custom arguments"
And the first item also worries me, I haven't found anything like that neither, so I'm afraid that perhaps there is something that the PHP API does behind the scenes.
This a example of the code we use.
$sendgrid = new SendGrid(env('SENDGRID_APIKEY'));
$from_m = new SendGrid\Email(null, $from);
$to_m = new SendGrid\Email(null, $from);
$content = new SendGrid\Content("text/html", $body);
$mail = new SendGrid\Mail($from_m, '.', $to_m, $content);
$mail->personalization[0]->addBcc($tos);
$mail->personalization[0]->setSubject($subject);
$mail->personalization[0]->addSubstitution('%MemberName%', $name);
$mail->personalization[0]->addSubstitution('%url%', $hash_url);
$mail->setTemplateId($template_id);
$sendgrid->client->mail()->send()->post($mail);
We are using sendgrid/sendgrid: ~6.2
Twilio SendGrid developer evangelist here.
From my reading of your code and the guidelines you've been sent, you should be ok.
You don't appear to be using anything that needs to be enabled via the API, though you can check all the mail_settings and tracking_settings in the API reference here.
As you are using the library and calling the API you don't appear to be sending any extra headers.
You don't seem to be using any custom arguments, so you aren't applying any substitutions to them.
I do recommend that you upgrade your PHP helper library to version 7 from 6. That will ensure that the underlying library is also using the API in the most up to date manner.
Im rewriting a few scripts to make use of the new v4 signature for Amazon AWS.
I am trying to send an email using the code on this page:
https://github.com/okamos/php-ses
When I use his code exactly as it is just adding secret keys etc I get an error saying my email address isnt verified on us_east_1. This makes sense as all my things are on EU_WEST_1.
So Ive tried adding the EU endpoint as a third parameter but get this error:
'Warning: SimpleEmailService::sendEmail(): 6 Could not resolve host: EU_WEST_1'
This is the line of code which seems to work but connecting to the wrong endpoint
$ses = new SimpleEmailService('apikey', 'secretkey');
print_r($ses->sendEmail($m));
I have tried adding the new endpoint as the third parameter like this
$ses = new SimpleEmailService('apikey', 'secret','eu-west-1');
But that just generates the error.
Can anyone tell me the correct code to use to set the eu-west-1 endpoint to send emails through?
Thanks
I had faced the same problem with AWS PHP library for uploading files to S3. Even though I was setting up the region from us-east-1 to eu-west-1 it was still taking us-east-1 as by default. I would suggest you to look for region configurations in library and how it is overriding.
SES Email Host for us-east-1 and eu-west-1 are different. So even though if you are passing correct API and Secret, it might not work because of default region.
If this debug process doesn't work can share the screenshot of what you region you are getting before email dispatch. I would love to explore further.
I found the problem.
Looks like there was a typo within the code on github, it had these 3 lines in the file 'SimpleEmailServices.php:
const AWS_US_EAST_1 = 'email.us-east-1.amazonaws.com';
const AWS_US_WEST_2 = 'email.us-west-2.amazonaws.com';
const AWS_EU_WEST1 = 'email.eu-west-1.amazonaws.com';
He'd missed the underscore in the AWS_EU_WEST1.
I have installed zyx-phpmailer extension for send mail function in yii2 and working properly. But, when i checked via yii debugger the recipient is empty. If I using swiftmailer, there is no problem, but I must using zyx-phpmailer :(
code :
Yii::$app->mailer->compose()
->setTo('people#blabla.com')
->setFrom('admin#example.com')
->setSubject('Test')
->send();
Result (yii debugger) :
From : admin#example.com
To : empty // <- this is a problem
Subject : Test
Text body (not set)
Successfully sent : Yes
How to solve this issue? I'm still learning using yii2 framework.
Check if your current mailer is actually the new extension and not SwiftMailer, you can trace it at runtime by calling this Yii::trace(Yii::$app->get('mailer')). Maybe you did not fully configure it.
Try ->setTo(['people#blabla.com' => 'People Blabla']). The first one being the email address itself and the second one being the name.
it work;try
Yii::$app->mail->compose()
->setFrom(['xx#xx.com' => 'My Example Site'])
->setTo([$form->email => $form->name])
->setSubject($form->subject)
->setTextBody($form->text)
->send();
my application use piwik for statistics. when I config the mail section. something wrong happen. the config is like this:
[mail]
transport = "smtp"
port = "587"
host = "smtp.qq.com"
type = "Login"
username = "username#qq.com"
password = "*********"
encryption = "tls"
and when transfer a mail the error information is like this:
An error occurred while sending 'PDF Email Report -
1.2016-11-15.2.zh-cn.pdf' to *******#qq.com. Error was 'mail from address must be same as authorization user'
and I google with this info , but nothing I found work fine.
I guess there was somewhere I can put the address from as I do before. But I don't find the place.
Could someone tell something about this question, thanks a lot.
I have handle this question. The solution is add a line in config/config.ini.php [General] code section.
noreply_email_address = username#qq.com
I don't know how it work. but obviously, it work.
Hope this solution can help someone !
I'm trying to create a ticket in osticket through its REST API (https://github.com/osTicket/osTicket-1.7/blob/develop/setup/doc/api/tickets.md)
The problem is /api/tickets.json returns 404. I have it installed in a server on osticket folder (something like http://my.net.work.ip/osticket/api/tickets.json - 404)
Also, I've tried to CURL the server (logged in through ssh), created an APIKey for the server's IP address and had the same response.
What am I missing here?
Thank you
So, I had to add http.php after api/ (/api/http.php/tickets.json) and now I can create tickets.
Check http://tmib.net/using-osticket-1812-api. The sample used has this info in the comments.
The two really important parts are on lines 18 and 19.
'url'=>'http://your.domain.tld/api/http.php/tickets.json', // URL to site.tld/api/tickets.json
'key'=>'PUTyourAPIkeyHERE' // API Key goes here
//Edit line 18 to have your URL.
//Edit line 19 by changing "PUTyourAPIkeyHERE" to your API key (aka the "THISISAFAKEAPIKEYHERE!" from earlier).
The piece that seems to be missing from the docs is how to pass the API key. Through a bit of testing and the script mentioned above, I found the X-API-Key header. That means you can create tickets without using a script, you can use curl as easily as:
curl -X POST -H "X-API-Key: 1234567890ABCDEF" -v -d'{"autorespond":false, "source": "API", "name": "Doctor Who", "email":"who#tardis.com", "subject":"Have you seen my Tardis key?", "message":"I have managed to lock myself out of the Tardis, can you send me a spare key?"}' http://support.gallifrey.org/api/tickets.json
This will only work if it is run from the IP address you specified when you created the API key.
Besides changing lines 18 and 19 you need to make sure that you have the correct IP address. You can check that by going to your site here: http://your.domain.tld/support/scp/logs.php
Then look to see if you get the error API Error (401). If you do then look at the IP address and create a new API key for that IP address.
The problem I was facing was I typed in my IPv4 address, but the server was getting my IPv6 address.