473,567 Members | 2,897 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

google smtp with php

116 New Member
how can we use google smtp server to send mail using php

here's my current php script

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. $toName        = "my name";
  4. $toEmail    = "myemail@example.org";
  5. $subject    = "success";
  6.  
  7. $name        = $_POST["name"];
  8. $email        = $_POST["email"];
  9.  
  10.  
  11.  
  12. $headers = "From: Your Name <myemail@example.org>" . "\r\n";
  13. $headers .= "Reply-To: Your Name <myemail@example.org>" . "\r\n";
  14. $headers .= "X-Mailer: PHP/" . phpversion();
  15.  
  16. $message= "name: $name
  17. email: $email
  18.  
  19.  
  20. ";
  21.  
  22. $replySubject    = "Mail from me";
  23. $replyMessage    = "I will reply to your query soon";
  24.  
  25.  
  26. // send email  to You //
  27.  
  28.  
  29.     mail($toName." <".$toEmail.">", $subject, $message, "From: ".$name." <".$email.">");
  30. // send email  to You //
  31.  
  32.     print "process=complete";
  33.  
  34. // send reply email to inquirer //
  35.     mail ($name." <".$email.">", $replySubject, $replyMessage, $headers);
  36. // send reply email to inquirer //
  37.  
  38. ?>
  39.  
Dec 29 '09 #1
5 2890
miraan
24 New Member
The smtp server you use is configured on your server, for example, your Apache configuration file. I'm not sure if Google allow everyone to use their smtp server though. You might want to check.
Dec 29 '09 #2
angelicdevil
116 New Member
isnt there a way i can send in the remote server details in the php and ask mail function to use the details provided in the script itself
Jan 4 '10 #3
Dormilich
8,658 Recognized Expert Moderator Expert
I'm not sure if Google allow everyone to use their smtp server though.
all you need is a google account (usually).
and ask mail function to use the details provided in the script
you might have read that mail() doesn’t use an SMTP server …
Jan 4 '10 #4
angelicdevil
116 New Member
so any other way other than mail();
Jan 4 '10 #5
Dormilich
8,658 Recognized Expert Moderator Expert
of course. there is e.g. the SwiftMailer library
Jan 4 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2798
by: Dan Boyle | last post by:
Hi, I am having difficulty connection to an smtp host. I am using the following code but I don't think I fully understand what smtp host can be used. function setSMTPParams($host = null, $port = null, $helo = null, $auth = null, $user = null, $pass = null) { if (!is_null($host)) $this->smtp_params = $host;
21
3347
by: Nancy | last post by:
Hi, Guys, Is there any other way to use python or mod_python writing a web page? I mean, not use "form.py/email", no SMTP server. <form action="form.py/email" method="POST"> ... Thanks a lot. Nancy W
2
13694
by: RandRace | last post by:
I'm having some problems with a little script i wrote using net::smtp. I originally wrote it in linux where it works perfectly. I tried to use it from windows the other day and it doesn't work. It connects to the server and prints the banner but will not send mail. Here is my script: use Net::SMTP; my $smtp =...
3
5552
by: dale zhang | last post by:
Hi, I write an asp.net web application. It has a “Contact Us” page, where users fill in their email, subject and text and hit send. Then the email will go to my hard coded yahoo email account. I was using optimum online service with smtp server as “mail.optonline.net”. I can receive email correctly. Now I switch to verizon DSL....
1
8033
by: bivin | last post by:
hai i am requesting your technical support. please help me. i have been working with this for five days. the problem is relating with the smtp. i am trying to send an email from the asp.net page. earlier it was showing send using not find error.
34
18184
by: antonyliu2002 | last post by:
I've set up the virtual smtp server on my IIS 5.1 like so: 1. Assign IP address to "All Unassigned", and listen to port 25. 2. Access Connection granted to "127.0.0.1". 3. Relay only allow "127.0.0.1". 4. Authentication: "Anonymous access" only. 5. Outbound connection listen to TCP 25. Besides,
3
4140
by: IanReardon | last post by:
Is it possible to configure an external SMTP server to route all of your outgoing mail through on Linux? I know in php.ini there is a parameter, but it says its only for windows? Can I do this on Linux?
13
6782
by: jcor | last post by:
Hi, I'm trying some code to send a mail with my script. This is it: #!/usr/bin/perl use Net::SMTP; my $smtp_server='62.193.245.15'; my $smtp = Net::SMTP->new($smtp_server) or die "Can't Open server\n"; $smtp->mail('joao.correia@tvn.pt'); $smtp->to('jcor@sapo.pt'); $smtp->auth("joao.correia@tvn.pt","*password*");
5
5292
by: jimhill10 | last post by:
I have a perl script that creates an email attachment file from POST data on a web page. This works just fine. I want to customize the email body to contain all of the text data from the file itself. I thought this would be just a matter of using the $smtp->datasend($POSTvalues) with the $values coming from the names on the web page posting the...
0
7688
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7590
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7905
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8115
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7651
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7960
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5488
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3630
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2093
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.