cUrl Sendgrid email upload Attached file broken or file is is 1kb
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
×
Query
Please fill in this form to submit your query.
Name<label for="file"><b>Upload CV </b></label><br>
<input type="file" name="photo" class="form-control" accept=".pdf" required/><br>
<p>By creating an account you agree to our <a href="#" style="color:dodgerblue">Terms & Privacy</a>.</p>
<div class="clearfix">
<button type="submit" class="signupbtn btnsubmityourquery" name="submit" value="submit" id="submit">Submit
your Query
<?php
$name = $_POST['name'];
$file_name = $_FILES['photo']['name'];
$tmp_name = $_FILES["photo"]["tmp_name"];
$file_type = $_FILES["photo"]["type"];
$uploadOk = 1;
if(isset($_POST['submit'])) {
if(isset($_FILES['photo'])) {
require 'sendgrid-php/vendor/autoload.php';
//Dotenv::load(__DIR__);
$sendgrid_apikey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$sendgrid = new SendGrid($sendgrid_apikey);
$url = 'https://api.sendgrid.com/';
$pass = $sendgrid_apikey;
$documentList = array(
$file_name => "@" . realpath($file_name )
);
$params = array(
'to' => "xxxxxxxxxxxxxx@gmail.com",
//'toname' => "Gmail yyy",
'from' => "yyyyyyyyyyyyyyy@windowmaker.com",
'fromname' => 'yy Enquired',
'subject' => "yy Enquiry Form",
'html' => "<strong>eCatalog Enquiry Form</strong><br>
Name : ".$name.",<br>",
);
if(count($documentList)>0){
foreach($documentList as $fileName=>$documentPath){
$params['files['.$fileName.']'] = $documentPath;
}
}
$request = $url.'api/mail.send.json';
// Generate curl request
$session = curl_init($request);
// Tell PHP not to use SSLv3 (instead opting for TLS)
curl_setopt($session, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
curl_setopt($session, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $sendgrid_apikey));
// Tell curl to use HTTP POST
curl_setopt ($session, CURLOPT_POST, true);
// Tell curl that this is the body of the POST
curl_setopt ($session, CURLOPT_POSTFIELDS, $params);
// Tell curl not to return headers, but do return the response
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
// obtain response
$response = curl_exec($session);
$err = curl_error($session);
if (!curl_errno($session)) {
switch ($http_code = curl_getinfo($session, CURLINFO_HTTP_CODE)) {
case 200:
echo "<script>
alert('Thank you for your enquiry. The Windowmaker team will get back to you as soon as possible');
window.location.href='#';
</script>";
break;
default:
echo 'Unexpected HTTP code: ', $http_code, "n";
echo "cURL Error #:" . $err;
}
}
curl_close($session);
}
}
?>
image
javascript php jquery curl sendgrid-api-v3
add a comment |
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
×
Query
Please fill in this form to submit your query.
Name<label for="file"><b>Upload CV </b></label><br>
<input type="file" name="photo" class="form-control" accept=".pdf" required/><br>
<p>By creating an account you agree to our <a href="#" style="color:dodgerblue">Terms & Privacy</a>.</p>
<div class="clearfix">
<button type="submit" class="signupbtn btnsubmityourquery" name="submit" value="submit" id="submit">Submit
your Query
<?php
$name = $_POST['name'];
$file_name = $_FILES['photo']['name'];
$tmp_name = $_FILES["photo"]["tmp_name"];
$file_type = $_FILES["photo"]["type"];
$uploadOk = 1;
if(isset($_POST['submit'])) {
if(isset($_FILES['photo'])) {
require 'sendgrid-php/vendor/autoload.php';
//Dotenv::load(__DIR__);
$sendgrid_apikey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$sendgrid = new SendGrid($sendgrid_apikey);
$url = 'https://api.sendgrid.com/';
$pass = $sendgrid_apikey;
$documentList = array(
$file_name => "@" . realpath($file_name )
);
$params = array(
'to' => "xxxxxxxxxxxxxx@gmail.com",
//'toname' => "Gmail yyy",
'from' => "yyyyyyyyyyyyyyy@windowmaker.com",
'fromname' => 'yy Enquired',
'subject' => "yy Enquiry Form",
'html' => "<strong>eCatalog Enquiry Form</strong><br>
Name : ".$name.",<br>",
);
if(count($documentList)>0){
foreach($documentList as $fileName=>$documentPath){
$params['files['.$fileName.']'] = $documentPath;
}
}
$request = $url.'api/mail.send.json';
// Generate curl request
$session = curl_init($request);
// Tell PHP not to use SSLv3 (instead opting for TLS)
curl_setopt($session, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
curl_setopt($session, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $sendgrid_apikey));
// Tell curl to use HTTP POST
curl_setopt ($session, CURLOPT_POST, true);
// Tell curl that this is the body of the POST
curl_setopt ($session, CURLOPT_POSTFIELDS, $params);
// Tell curl not to return headers, but do return the response
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
// obtain response
$response = curl_exec($session);
$err = curl_error($session);
if (!curl_errno($session)) {
switch ($http_code = curl_getinfo($session, CURLINFO_HTTP_CODE)) {
case 200:
echo "<script>
alert('Thank you for your enquiry. The Windowmaker team will get back to you as soon as possible');
window.location.href='#';
</script>";
break;
default:
echo 'Unexpected HTTP code: ', $http_code, "n";
echo "cURL Error #:" . $err;
}
}
curl_close($session);
}
}
?>
image
javascript php jquery curl sendgrid-api-v3
add a comment |
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
×
Query
Please fill in this form to submit your query.
Name<label for="file"><b>Upload CV </b></label><br>
<input type="file" name="photo" class="form-control" accept=".pdf" required/><br>
<p>By creating an account you agree to our <a href="#" style="color:dodgerblue">Terms & Privacy</a>.</p>
<div class="clearfix">
<button type="submit" class="signupbtn btnsubmityourquery" name="submit" value="submit" id="submit">Submit
your Query
<?php
$name = $_POST['name'];
$file_name = $_FILES['photo']['name'];
$tmp_name = $_FILES["photo"]["tmp_name"];
$file_type = $_FILES["photo"]["type"];
$uploadOk = 1;
if(isset($_POST['submit'])) {
if(isset($_FILES['photo'])) {
require 'sendgrid-php/vendor/autoload.php';
//Dotenv::load(__DIR__);
$sendgrid_apikey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$sendgrid = new SendGrid($sendgrid_apikey);
$url = 'https://api.sendgrid.com/';
$pass = $sendgrid_apikey;
$documentList = array(
$file_name => "@" . realpath($file_name )
);
$params = array(
'to' => "xxxxxxxxxxxxxx@gmail.com",
//'toname' => "Gmail yyy",
'from' => "yyyyyyyyyyyyyyy@windowmaker.com",
'fromname' => 'yy Enquired',
'subject' => "yy Enquiry Form",
'html' => "<strong>eCatalog Enquiry Form</strong><br>
Name : ".$name.",<br>",
);
if(count($documentList)>0){
foreach($documentList as $fileName=>$documentPath){
$params['files['.$fileName.']'] = $documentPath;
}
}
$request = $url.'api/mail.send.json';
// Generate curl request
$session = curl_init($request);
// Tell PHP not to use SSLv3 (instead opting for TLS)
curl_setopt($session, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
curl_setopt($session, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $sendgrid_apikey));
// Tell curl to use HTTP POST
curl_setopt ($session, CURLOPT_POST, true);
// Tell curl that this is the body of the POST
curl_setopt ($session, CURLOPT_POSTFIELDS, $params);
// Tell curl not to return headers, but do return the response
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
// obtain response
$response = curl_exec($session);
$err = curl_error($session);
if (!curl_errno($session)) {
switch ($http_code = curl_getinfo($session, CURLINFO_HTTP_CODE)) {
case 200:
echo "<script>
alert('Thank you for your enquiry. The Windowmaker team will get back to you as soon as possible');
window.location.href='#';
</script>";
break;
default:
echo 'Unexpected HTTP code: ', $http_code, "n";
echo "cURL Error #:" . $err;
}
}
curl_close($session);
}
}
?>
image
javascript php jquery curl sendgrid-api-v3
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
code is ok i got email but i cant get actual pdf file size . its just
1kb i got file size
×
Query
Please fill in this form to submit your query.
Name<label for="file"><b>Upload CV </b></label><br>
<input type="file" name="photo" class="form-control" accept=".pdf" required/><br>
<p>By creating an account you agree to our <a href="#" style="color:dodgerblue">Terms & Privacy</a>.</p>
<div class="clearfix">
<button type="submit" class="signupbtn btnsubmityourquery" name="submit" value="submit" id="submit">Submit
your Query
<?php
$name = $_POST['name'];
$file_name = $_FILES['photo']['name'];
$tmp_name = $_FILES["photo"]["tmp_name"];
$file_type = $_FILES["photo"]["type"];
$uploadOk = 1;
if(isset($_POST['submit'])) {
if(isset($_FILES['photo'])) {
require 'sendgrid-php/vendor/autoload.php';
//Dotenv::load(__DIR__);
$sendgrid_apikey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$sendgrid = new SendGrid($sendgrid_apikey);
$url = 'https://api.sendgrid.com/';
$pass = $sendgrid_apikey;
$documentList = array(
$file_name => "@" . realpath($file_name )
);
$params = array(
'to' => "xxxxxxxxxxxxxx@gmail.com",
//'toname' => "Gmail yyy",
'from' => "yyyyyyyyyyyyyyy@windowmaker.com",
'fromname' => 'yy Enquired',
'subject' => "yy Enquiry Form",
'html' => "<strong>eCatalog Enquiry Form</strong><br>
Name : ".$name.",<br>",
);
if(count($documentList)>0){
foreach($documentList as $fileName=>$documentPath){
$params['files['.$fileName.']'] = $documentPath;
}
}
$request = $url.'api/mail.send.json';
// Generate curl request
$session = curl_init($request);
// Tell PHP not to use SSLv3 (instead opting for TLS)
curl_setopt($session, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
curl_setopt($session, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $sendgrid_apikey));
// Tell curl to use HTTP POST
curl_setopt ($session, CURLOPT_POST, true);
// Tell curl that this is the body of the POST
curl_setopt ($session, CURLOPT_POSTFIELDS, $params);
// Tell curl not to return headers, but do return the response
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
// obtain response
$response = curl_exec($session);
$err = curl_error($session);
if (!curl_errno($session)) {
switch ($http_code = curl_getinfo($session, CURLINFO_HTTP_CODE)) {
case 200:
echo "<script>
alert('Thank you for your enquiry. The Windowmaker team will get back to you as soon as possible');
window.location.href='#';
</script>";
break;
default:
echo 'Unexpected HTTP code: ', $http_code, "n";
echo "cURL Error #:" . $err;
}
}
curl_close($session);
}
}
?>
image
javascript php jquery curl sendgrid-api-v3
javascript php jquery curl sendgrid-api-v3
asked Nov 21 at 6:39
hirenVaishnav
16
16
add a comment |
add a comment |
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53406503%2fcurl-sendgrid-email-upload-attached-file-broken-or-file-is-is-1kb%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53406503%2fcurl-sendgrid-email-upload-attached-file-broken-or-file-is-is-1kb%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown