Jump to content
Sign in to follow this  
sandeepm

swift mailer not sending the mails

Recommended Posts

$email = $_POST['email'];require_once "/var/www/html/swift_mailer/swift_required.php";// Create the Transport$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com',***,'ssl')->setUsername('*******@****.com')->setPassword('***');// Create the Mailer using your created Transport$mailer = Swift_Mailer::newInstance($transport);// Create a message$message = Swift_Message::newInstance('Test Swift Mail Setup')->setFrom(array('******@***.com' => 'Statreferral Admin'))->setTo($email)->setBody($content,'text/html');// Send the message$result = $mailer->send($message);

 

What is the wrong in this code pplease suggest me......

how can i check whether username contain mail server or not.....

 

 

 

Share this post


Link to post
Share on other sites

are you checking for errors or adding error reporting? whats the value of $result?

 

also, not sure what you mean by

 

how can i check whether username contain mail server or not.....

 

are you asking how you can check if an email address really exists?

Share this post


Link to post
Share on other sites

It's fairly difficult to check if an address actually exists. If you want to make sure that a value is in the correct form for an email address then you can use the filter_var function, there are examples here:http://php.net/manual/en/function.filter-var.php

Share this post


Link to post
Share on other sites

Or send the user a confirmation email with a confirmation link validating they are the owner of said email address.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...