Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7094039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:30:51+00:00 2026-05-28T08:30:51+00:00

<?php require_once ‘../plugin/swift/lib/swift_required.php’; // Create the Transport $transport = Swift_SmtpTransport::newInstance(‘pod51003.outlook.com’,587,’tls’) ->setUsername(‘user@connect.polyu.hk’) ->setPassword(‘pw’) ; //

  • 0
<?php

  require_once '../plugin/swift/lib/swift_required.php';

  // Create the Transport
  $transport = Swift_SmtpTransport::newInstance('pod51003.outlook.com',587,'tls')
    ->setUsername('user@connect.polyu.hk')
    ->setPassword('pw')
    ;

  // Create the Mailer using your created Transport
  $mailer = Swift_Mailer::newInstance($transport);

  // Create a message
  $message = Swift_Message::newInstance('Wonderful Subject')
    ->setFrom(array('john@doe.com' => 'John Doe'))
    ->setTo(array('foodil@hotmail.com', 'foodil@yahoo.com.hk' => 'A name'))
    ->setBody('Here is the message itself')
    ;

  // Send the message
  $result = $mailer->send($message);

  printf("Sent %d messages\n", $result);

?>

It turned out:

Fatal error: Uncaught exception 'Swift_TransportException' 
with message 'Expected response code 250 but got code "501", with message "501 5.5.4 Invalid domain name "' 
in C:\xampp\htdocs\fyp\plugin\swift\lib\classes\Swift\Transport\AbstractSmtpTransport.php:422 

Stack trace: 
#0 C:\xampp\htdocs\fyp\plugin\swift\lib\classes\Swift\Transport\AbstractSmtpTransport.php(306): Swift_Transport_AbstractSmtpTransport->_assertResponseCode('501 5.5.4 Inval...', Array) 
#1 C:\xampp\htdocs\fyp\plugin\swift\lib\classes\Swift\Transport\EsmtpTransport.php(224): Swift_Transport_AbstractSmtpTransport->executeCommand('HELO [::1]??', Array, Array) 
#2 C:\xampp\htdocs\fyp\plugin\swift\lib\classes\Swift\Transport\AbstractSmtpTransport.php(323): Swift_Transport_EsmtpTransport->executeCommand('HELO [::1]??', Array) 
#3 C:\xampp\htdocs\fyp\plugin\swift\lib\classes\Swift\Transport\EsmtpTransport.php(272): Swift_Transport_AbstractSmtpTransport->_doHeloCommand() 
#4 C:\xampp\htdocs\fyp\plugin\swift\lib\classes\Swift\Transport\AbstractSmtpTransport.php(124) in C:\xampp\htdocs\fyp\plugin\swift\lib\classes\Swift\Transport\AbstractSmtpTransport.php on line 422

Actually I follow the tutorial straightly, so is that any thing I omitted in my code? The SMTP server information is valid.

External SMTP setting:
Server name: pod51003.outlook.com – you can also see the note below on how to determine the server name
Port: 587
Encryption method: TLS

after adding the line: there is another error:

Warning: stream_socket_enable_crypto() [streams.crypto]: this stream does not support SSL/crypto in C:\xampp\htdocs\fyp\plugin\swift\lib\classes\Swift\Transport\StreamBuffer.php on line 102

Fatal error: Uncaught exception 'Swift_TransportException' 
with message 'Unable to connect with TLS encryption' 
in C:\xampp\htdocs\fyp\plugin\swift\lib\classes\Swift\Transport\EsmtpTransport.php:283 

Stack trace: 
#0 C:\xampp\htdocs\fyp\plugin\swift\lib\classes\Swift\Transport\AbstractSmtpTransport.php(124): Swift_Transport_EsmtpTransport->_doHeloCommand() 
#1 C:\xampp\htdocs\fyp\plugin\swift\lib\classes\Swift\Mailer.php(79): Swift_Transport_AbstractSmtpTransport->start() 
#2 C:\xampp\htdocs\fyp\mail\send.php(26): Swift_Mailer->send(Object(Swift_Message)) 
#3 {main} thrown in C:\xampp\htdocs\fyp\plugin\swift\lib\classes\Swift\Transport\EsmtpTransport.php on line 283
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T08:30:52+00:00Added an answer on May 28, 2026 at 8:30 am

    Try adding this line here as shown:

    // Create the Transport
    $transport = Swift_SmtpTransport::newInstance('pod51003.outlook.com',587,'tls')
    ->setUsername('user@connect.polyu.hk')
    ->setPassword('pw')
    ;
    
    // ADD THIS LINE
    $transport->setLocalDomain('[127.0.0.1]');
    
    // Create the Mailer using your created Transport
    $mailer = Swift_Mailer::newInstance($transport);
    

    I’m guessing your SMTP server doesn’t like/understand IPv6, based on the response you are getting to the HELO command.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my code: <?php require_once 'Swift/lib/swift_required.php'; $transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465) ->setUsername('me@ff.com') ->setPassword('pass'); $mailer
<?php require_once 'swift-mailer/lib/swift_required.php'; if (isset($_POST['submit'])) { //File upload // Where the file is going
My application file: <?php // /src/app.php require_once __DIR__ . '/../lib/vendor/Sensio/silex.phar'; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response;
<?php require_once Mail.php; $from = <niko@gmail.com>; $to = <niko@hotmail.com>; $subject = Hi!; $body =
I have some files: core.php : require_once 'logger.php'; require_once 'smth_else.php'; $Logger = new Logger();
My form class: <?php require_once ('Zend\Form.php'); class Sergio_Form_registrationform extends Zend_Form { public function init(){
Simple question: Is the scope of require_once global? For example: <?PHP require_once('baz.php'); // do
index.php: <form action=update_db.php method=post> <?php require_once 'modules/' . $currentModule . '.php'; ?> </form> modules/
Here's my Zend code: <?php require_once ('Zend\Form.php'); class Sergio_Form_registrationform extends Zend_Form { public function
I add this class to library/My/Validate/PasswordConfirmation.php <?php require_once 'Zend/Validate/Abstract.php'; class My_Validate_PasswordConfirmation extends Zend_Validate_Abstract {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.