Why would wp_mail think it’s succeeding, but not actually send mail?

I am using the wp_mail function within WordPress, but it only works sometimes. When I look at the error log, it says that mail is succeeding. This function is also being used for another email being sent – but that one works (at least sometimes, anyway).

if ( wp_mail( $emailTo, $subject, $body, $headers ) ) {
    error_log('mail success');
} else {
    error_log('mail fail');
}

What am I missing?

Twilio Reject Call and Send to Voicemail

I have a simple call structure folder with PHP and XML on my server. To handle my incoming calls for my business.

I can’t seem to get it to forward to voicemail without errors.

Here is how the call gets triggered.

Customer Calls -> Routes to Webhook -> Handle-Incoming-Call.XML

    <?xml version="1.0" encoding="UTF-8"?>
<Response>
    
    <Redirect>handle-extension.php</Redirect>
</Response>

Then Handle-Extension.PHP looks like this

<?php
    header('Content-type: text/xml');
    echo '<?xml version="1.0" encoding="UTF-8"?>';

    echo '<Response>';

    
        # @start snippet
        echo '<Say>Thank you for calling, My Business</Say>';
        echo '<Dial record="true" timeout="15" action="voicemail.php">';
        echo '<Number url="screen-caller.xml">+10000000000</Number>';
        echo '</Dial>';
        # @end snippet
    
    echo '</Response>';
?>

Then Screen-Caller.XML looks like this (This is what me as a business will hear when I pick up)

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Gather action="handle-screen-input.php" numDigits="1">
        <Say>Call for Your Business</Say>
        <Say>To accept the call, press 1.</Say>
        <Say>To reject the call, press 2.</Say>
    </Gather>

</Response>

When I press 1 I get the call, but when I press 2 I want it to go to voicemial.

Here is the Handle-Screen-Input.PHP

<?php
    header('Content-type: text/xml');
    echo '<?xml version="1.0" encoding="UTF-8"?>';

    echo '<Response>';

    $user_pushed = (int) $_REQUEST['Digits'];

    if ($user_pushed == 1)
    {
        echo '<Say>Connecting, say hello.</Say>';
    }
    else {
        echo '<Hangup />';
    }

    echo '</Response>';
?>

I did a bypass for now so I created another Webhook to go to a TwimLets Forwarding Voicemail to Email when it fails.

Here is the fail message I get from LOGS

An attempt to retrieve content from https://website.com/callsystem/voicemail.php returned the HTTP status code 500. Falling back to http://twimlets.com/voicemail?Email=email%40email.com&Message=Please%20leave%20a%20message%20after%20the%20beep.&Transcribe=true&

So when it gets to the error it goes to my fallback WebHook, I still get the voicemail but I get tons of error logs at the end of the day.

I am trying to figure out what I am missing to get the voicemail.php to work.

Here is the voicemail.php code I found in one of the posts here in Stack.

header("content-type: text/xml");
    echo '<?xml version="1.0" encoding="UTF-8"?>';
    $email = $_REQUEST['email'];
?>
<Response>
    <?php if ($_REQUEST['DialCallStatus'] == 'completed') { ?>
            <Hangup/>
    <?php } else { ?>
            <Say>Sorry Our Business is not available at this time, Please leave a message at the tone.  Press the star key when finished.</Say>
            <Record transcribe="true" action="goodbye.php" transcribeCallback="voicemail-send.php?email=<?php echo $email; ?>" maxLength="120" finishOnKey="*" />
            <Say>I did not receive a recording.</Say>
            <Redirect>voicemail.php</Redirect>
    <?php } ?>
</Response>

Do I need to add a file name “voicemail-send.php” if so what is that structure look like?

Any help would be greatly appreciated. Thank you

What is the right way to add a new product property in WooCommerce?

I’ve just started learning about WordPress and WooCommerce. My problem is that products there lack properties like expiration date, origin or similar that I might think of in the future (for every single product these fields are probably going to be different, not that many duplicates). I know that it might be possible to achieve this functionality with attributes (?) but I’m not entirely sure. My idea is to create a module with a separate database which would have a relationship with each product (or post). Is that the right approach? What I am trying to achieve at the end of the day is to create a dashboard in the front end where some users will be able to add or edit certain products and those fields are necessary to be in that dashboard. Or maybe you have any other suggestions? Thank you.

PHP Get price from span

Im new in PHP. Can you tell me how can I get price from span named “wordCounterPrice”. I have something like this:

class getPrice {
    public $price;
    public function __construct($data){
        $this->price = addslashes($data['wordCounterPrice']);
    }
}
...
if(isset($_POST['count'])){
    echo '<script>location.href="#test"</script>';
    $price = new getPrice($_POST);
...
}

HTML:

<span id="wordCounterPrice" name="wordCounterPrice">0</span>
<button type="submit" name="count" id="count" class="btn btn-primary">Get it</button>

So much thanks

Create Tweet API not working for other users

I’ve created a Twitter developer account with my profile and passing cosumer_key, consumer_secret, token_id, and token_secret and If I’m hitting create-tweet 'https://api.twitter.com/1.1/statuses/update.json' API then I’m getting a proper response but if I’m creating tweets with other users credentials I’m getting an error
([errors]=> Array([code] => 32, [message] => Could not authenticate you.)). I’ve given read & write permission to my app as well.

    public function createTweet(Request $req) {
    Log::channel('twitterwebhook')->info($req->all());

    $access_token = $req->require('token_id');
    $acess_token_secret = $req->require('token_secret');
    $message = $req->require('message');
    $twitter = new TwitterAPI($access_token, $acess_token_secret);

    $response = $twitter->createTweet($message);
    
    if(isset($response->errors)){
        return error($response->errors, 4099);
    }
    $data = [
        'tweet_id'=> $response->id,
        'tweet_str_id' =>$response->id_str,
        'message' =>$response->text,
        'user_twitter_id'=>$response->user->id,
        'user_twitter_name'=>$response->user->name,
        'user_twitter_screen_name'=>$response->user->screen_name
    ];
    return success($data);
}

public function createTweet($tweet_message) {
    $postfields = [
        'status' => $tweet_message, 
        'trim_user' => false
    ];

    $twitterResponse =  $this->buildOauth($this->_update_url, 'POST')
                             ->setPostfields($postfields)
                             ->performRequest();
    return json_decode($twitterResponse);

}

@php tag in blade template can’t reach inline variable

I am looping through products which has all my configurable options available. Inside that i am looping through my items, when i get a match in product i want to display this product and item.

To do so i want to create a variable called $currentProduct.

@foreach($order['products'] as $product) // Configurable products
    @foreach($order['items'] as $item)  // Simple products
        @if ($item['product_type'] == 'simple')
            @if ($product['id'] === $item['product_id'])
                @php($currentProduct = $product) // error here $product undefined
                @php($currentItem = $item) // error here $item undefined
            @endif
        @elseif ($item['product_type'] == 'configurable')
            @if ($product['id'] == $item['parent_item']['product_id'])
                @php($currentProduct = $product) // error here $product undefined
                @php($currentItem = $item) // error here $item undefined
            @endif
        @endif
    @endforeach
@endforeach

I am new to laravel and blade templates and can’t seem to wrap my head around, why $product and $item is undefined when they are defined right above in same template.

Any help appreciated

how to display and hide the watermark on a video using ffmpeg

i’m new to ffmpeg i want to add any animation to the watermark
this is my php code:

$source=$_SERVER['DOCUMENT_ROOT']."/content/uploads/".$row['source'];
            $command = "ffmpeg -i ".$source." -i medada.png";
            $command .= " -filter_complex "[0:v][1:v]";
            $command .= " overlay=25:150""; 
            $str = rand();
            $result = hash("sha256", $str);
            $path_info = pathinfo($source);
            $extension=$path_info['extension'];
            $command .= " -c:a copy ".$_SERVER['DOCUMENT_ROOT']."/content/downloads/".$result.".".$extension."";

Unable to connect to localhost:2525

i’m trying to send email using google mail and i’m having this error i tried doing it with mailtrap it gaves me the same error
Connection could not be established with host localhost :stream_socket_client(): Unable to connect to localhost:2525 (No connection could be made because the target machine actively refused it)
i don’t know whats the relation between the localhost and the port 2525, i’m not trying to use the port this is my .env file

APP_ENV=local
APP_KEY=************************
APP_DEBUG=true
APP_URL=https:****************************

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_DATABASE=superett_super
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465  
[email protected]
MAIL_PASSWORD=GeForce7ThGen
[email protected]
MAIL_FROM_NAME="${APP_NAME}"
MAIL_ENCRYPTION=tls

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

and this is my config/mail.php file i have already tried to change the host and the port in this file nothing works

<?php

return [
'default' => env('MAIL_MAILER', 'smtp'),

'mailers' => [
        'smtp' => [
            'transport' => 'smtp',
            'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
            'port' => env('MAIL_PORT', 587),
            'encryption' => env('MAIL_ENCRYPTION', 'tls'),
            'username' => env('MAIL_USERNAME'),
            'password' => env('MAIL_PASSWORD'),
            'timeout' => null,
            'auth_mode' => null,
        ],

        'ses' => [
            'transport' => 'ses',
        ],

        'mailgun' => [
            'transport' => 'mailgun',
        ],

        'postmark' => [
            'transport' => 'postmark',
        ],

        'sendmail' => [
            'transport' => 'sendmail',
            'path' => '/usr/sbin/sendmail -bs',
        ],

        'log' => [
            'transport' => 'log',
            'channel' => env('MAIL_LOG_CHANNEL'),
        ],

        'array' => [
            'transport' => 'array',
        ],

        'failover' => [
            'transport' => 'failover',
            'mailers' => [
                'smtp',
                'log',
            ],
        ],
    ],

'from' => [
        'address' => env('MAIL_FROM_ADDRESS', '[email protected]'),
        'name' => env('MAIL_FROM_NAME', 'Example'),
    ],

'markdown' => [
        'theme' => 'default',

        'paths' => [
            resource_path('views/vendor/mail'),
        ],
    ],

];

php passing data form

i use get method to pass data from index.php to profile.php

index.php code is

<html>
<body>

<form action="profile.php" method="GET">
username: <input type="text" username="user"><br>
password: <input type="password" name="pass"><br>
<input type="submit">
</form>

<button type="button" onclick="alert('task success')"/>click me"</button>

</body>
</html>

profile.php code is

<?php
    echo " username: "$_GET ['username']."; password "$_GET['pass'];
?>

the output is
enter image description here

it pass the inputs of the form successfully but i need it to appear in profile.php file

how can i make the output appear in profile.php page?

any help please

Limesurvey: Redirection on wrong port

I’m currently working on setting up a LimeSurvey (version 5.1.17) inside a Kubernetes cluster. When trying to access the /admin/ endpoint it works perfectly, but if I try to reach /admin endpoint, I am getting redirected to http://<URL>:8080/admin, which is the port pods are listening to.

I have tried modifying the .htaccess file to rewrite the url from /admin to /admin/ but it didn’t do anything, I can’t even set a 403 on /admin, it will redirect me in any case. I also searched across the code but I couldn’t find where was the problem.
It might come from Traefik but it doesn’t look like it’s modifying urls.

Thanks for your help.

Convert animated gif to webp in PHP

Is it possible to convert an animated GIF to WEBP using Imagick?

$im = new Imagick();
$im->pingImage( _INTERNAL_FOLDER_ . $dir . "/" . $id . "/animation.gif" );
$im->readImage( _INTERNAL_FOLDER_ . $dir . "/" . $id . "/animation.gif" );
$im->setImageFormat( "webp" );
$im->setImageCompressionQuality( 80 );
$im->setOption( 'webp:lossless', 'false' );
$im->writeImage( _INTERNAL_FOLDER_ . $dir . "/" . $id . "/animation.webp" );

When I do it this way, I get only first frame from the GIF and not the whole animation. I know that WEBP format supports animation, however I was unable to find if Imagick has this ability too.