different port numbers

$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->SMTPSecure = "tls";                 // sets the prefix to the servier
$mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
$mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
$mail->Host = "smtpout.secureserver.net";
$mail->Port       = 80;                   // set the SMTP port for server
$mail->Username   = "me@domain.com";  //  username 

Open in new window



I am using shared hosting on two accounts and I am told
different port numbers
some ssl, tls
different hostnames (2 different for godaddy.com, 2 different for 1and1.com)

is there to create arrays/forLoops/forEachLoops  to loop through the answers
because I would have to do alot of editing just to test one smtp email
LVL 1
rgb192Asked:
Who is Participating?
 
Loganathan NatarajanConnect With a Mentor LAMP DeveloperCommented:
I think you need dynamic way of filling the details on the variable like. It is better you design the form as like you change the port number, smtp details etc., and then you click to send mail.. so that you can place the values on the php coding.
0
 
g3nu1n3Commented:
Your question is a tad bit cryptic, can you be a little more specific in what you are trying to do and the details of what you have setup with GoDaddy and 1and1.
0
 
rgb192Author Commented:
hostnames

godaddy is
smtpout.secureserver.net
smtp.secureserver.net
relay-hosting.secureserver.net

1and1
smtp.1and1.com
mrelay.pefora.net

ports
25,80,465,587

2 different usernames

SMTPSecure=ssl,tls,''

and phpmailer will tell me if I get an error 110,111 or the mail gets sent
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
g3nu1n3Commented:
Are you saying that you want to create a loop so that you can send multiple emails via PHPMailer when the email is submitted the first time. For example, you have one form and a person fills out and then it sends that form to your different email accounts?
0
 
rgb192Author Commented:
I have asked godaddy and 1and1
and each employee has a different opinion of which hostname,smtpsecure,port will work

I tried godaddy and smtp was sent using
port 80,smtpout.secureserver.net, no smtp secure
and I copy paste many combinations to make 1and1 to try to send smtp

instead of manually trying each, I want to create a loop



>>
Are you saying that you want to create a loop so that you can send multiple emails via PHPMailer when the email is submitted the first time. For example, you have one form and a person fills out and then it sends that form to your different email accounts?


no form  (but you have a great idea and I will ask a related question)
yes loop


I will create the reporting at the end of the loop

  $mail->Send();
  echo "Mail was sent.</p>\n";
} catch (phpmailerException $e) {
  echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
  echo $e->getMessage(); //Boring error messages from anything else!
}


I will echo which combination (host, smtpsecure, port) creates a send, or error message
0
 
Julian HansenCommented:
@rgb192 - I have made this comment before - your questions are too vague for us to be able to follow you - which is why I suspect you need to do so many request for follow ups.

Having read the above I still have no idea what you are asking. I could take 10min to try and figure it out but I would rather have it explained to me clearly so I can rather spend that time working on a solution.

Just my 2c worth.
0
 
rgb192Author Commented:
>>form as like you change the port number, smtp details etc., and then you click to send mail

and

>> I would rather have it explained to me clearly so I can rather spend that time working on a solution.



I have found two email hosting companies (and there are other hosting companies that I think have this problem)
that do not know which hostname,port, smtpSecure which
echo "Mail was sent.</p>\n";


  $mail->Send();
  echo "Mail was sent.</p>\n";
} catch (phpmailerException $e) {
  echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
  echo $e->getMessage(); //Boring error messages from anything else!
}


it is difficult for me to create a form because I do not know which combination to use
so I have to guess and check


My question is to loop through all the values to see what phpmailer error number or which values send email
0
 
Loganathan NatarajanLAMP DeveloperCommented:
mmm, loop through may not work or cannot check properly.

you can create multiple variable like each provider settings as each variable like mail1, mail2 .. then you send and track the error.
0
 
Bernard S.CTOCommented:
Assuming you simply want to send email from php and looking for the solution with your hosting companies:

1 - It is probably simpler to test one after the other (not THAT many combinations) rather than to array things...

2 - I have some doubts for port 80 usually this is http rather than smtp

3 - The hotline of your hosting companies do certainly know how to give the precise answer, maybe some details you give them place them out of trajectory: the answers are usually very simple and should not overflow you with all these ssl and tls. Basically there are for each hosting company only TWO answers: one for regular non secure smtp (usually port 25) and the other one thru ssl-secured smtp (usually port 587). (see http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol )
Of course, each hosting company might decide, for security reasons, to have different port numbers... but it is still only TWO per hosting company.

4 - Sending mail by php mail() might be tricky if some headers are not correctly formatted, ie separated with the proper \n and/or \r combination. Have a look at http://www.php.net/manual/en/function.mail.php and the comments to get a better vision of some tricks
0
 
rgb192Author Commented:
>>- It is probably simpler to test one after the other (not THAT many combinations) rather than to array things...

godaddy worked for me with

port 80,smtpout.secureserver.net, no smtp secure

I tried other settings and got phpmailer 110,111 errors


>>The hotline of your hosting companies do certainly know how to give the precise answer,

I sent numerous emails with answers of different combinations
and I tried some copy paste combinations for 1and1.com with no luck


>>you can create multiple variable like each provider settings as each variable like mail1, mail2 .. then you send and track the error.

could you show me example
0
 
rgb192Author Commented:
Is there a way to do a loop or use a database to interate through the 3 values
Hostname, port, smtp (ssl or tls)
0
 
rgb192Author Commented:
hostgator writes
http://support.hostgator.com/articles/specialized-help/email/outlook-eudora-thunderbird-mac-ipad-phone-client-settings

Outgoing mail port: 25 (If 25 does not work, try 26, as some ISPs block port 25)
0
 
Bernard S.CTOCommented:
Your question seemed to mean that you have a smtp problem that you are tryong tpo solve by sending mail from one of your 2 ISPs

You have been given hints that would allow you to find by trial and error which combinations are working on these 2 ISPs.

Howvere you do insist on finding a looping solution: this hints at a totally different problem, exploring ports on servers.
On well configured servers, multiple tests on multiple ports will ring alarm bells and be interpreted as some hacking / pirating attempts, and might lead to your IP address to be banned for somewhile: somtehing between 15 minutes and 2 days will be common.
0
 
rgb192Author Commented:
My plan is to save the working settings.  I am looking to move away from gmail
Host gator admits port 25 or port 26 only will work


 http://support.hostgator.com/articles/specialized-help/email/outlook-eudora-thunderbird-mac-ipad-phone-client-settings
0
 
Bernard S.CTOCommented:
Since there are around 4 - 6 combinations to test... do that manually, it will just be 30 minutes...
0
 
rgb192Author Commented:
best answer, create a form

thank you
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.