1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Using the mail() function

Discussion in 'PHP' started by zdunham6287, Aug 3, 2007.

  1. zdunham6287

    zdunham6287 New Member

    Joined:
    Feb 7, 2007
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Pennsylvania, USA
    Home Page:
    I've been trying to use the mail() function mail a form on my website and it keeps failing, here is the code I'm using:

    I did output each of the variables previously to make sure it got the strings from the form and it did get them correctly, so I assumed it must be the mail() call.


    PHP:
    <?php
    $firstname 
    $_REQUEST['firstname'];
    $source $_REQUEST['source'];
    $addcorrect $_REQUEST['addcorrect'];
    $artist $_REQUEST['artist'];
    $album $_REQUEST['album'];
    $song $_REQUEST['song'];
    $lyrics $_REQUEST['lyrics'];
    $sent mail("imanidiot777@gmail.com","Add/Correct Lyrics","$firstname  $source  $addcorrect  $artist  $album  $song  $lyrics","From: $firstname");
    if(
    $sent)
        {print 
    "your message was sent";}
    else
        {print 
    "your message failed";}
    //header("location:addcorrect.html");
    ?>

    Any ideas? Thanks.
     
    Last edited by a moderator: Aug 3, 2007
  2. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,646
    Likes Received:
    86
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
  3. vipin.incat

    vipin.incat New Member

    Joined:
    Aug 20, 2007
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Using the E-mail function in VB script

    hi pradeep,
    i have written following code for E-mailing from VB script.
    it is asking yes or no confirmation and though after giving confirmation, mail is not going.
    can u help me on this and make it automatic.
    Code:
    Const olFolderContacts = 10
      sDistName = "ipms" 'set the distribution list name here
      
      Set objOutlook = CreateObject("Outlook.Application")
      Set objNamespace = objOutlook.GetNamespace("MAPI")
      
      Set colContacts = objNamespace.GetDefaultFolder(olFolderContacts).Items
      intCount = colContacts.Count
      
      For i = 1 To intCount
          If TypeName(colContacts.Item(i)) = "DistListItem" Then
              Set objDistList = colContacts.Item(i)
              sEmails = ""
              If objDistList.DLName = sDistName Then
                  For j = 1 To objDistList.MemberCount
                      sEmails = sEmails & ";" & objDistList.GetMember(j).Address
                  Next
                  
                  'send the mail using the emails u got! ;-) enjoy
              End if
          End If
      Next
    regards,
    vipin gupta
     
    Last edited by a moderator: Aug 20, 2007
  4. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,646
    Likes Received:
    86
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    You are not calling any send method, how do you expect the mail to be dispatched! All i can see is you are collecting contacts!
     
  5. vipin.incat

    vipin.incat New Member

    Joined:
    Aug 20, 2007
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    actually sir,
    i am working with automation and i need to send any e-mail or message on any mobile, on some critical event failure. what my software can do is integration with Vb-script.
    can u help me on this code .
    what i written is this:-
    Code:
    Sub OnMouseUp(x As Long, y As Long, flags As Long)
    Dim objOutlookMsg As Object
    Const olFolderContacts = 10
      sDistName = "ipms" 'set the distribution list name here
      
      Set objOutlook = CreateObject("Outlook.Application")
      Set objNamespace = objOutlook.GetNamespace("MAPI")
       Set objOutlookMsg = objOutlook.CreateItem(0)
      Set colContacts = objNamespace.GetDefaultFolder(olFolderContacts).Items
      intCount = colContacts.Count
    	   For i = 1 To intCount
          If TypeName(colContacts.Item(i)) = "DistListItem" Then
              Set objDistList = colContacts.Item(i)
              sEmails = ""
              If objDistList.DLName = sDistName Then
                  For j = 1 To objDistList.MemberCount
                      sEmails = sEmails & ";" & objDistList.GetMember(j).Address
                  Next
      	  with objOutlookMsg.To="vipin.gupta@incat.com"
                  
                  			  with objOutlookMsg.send
    
    			          End If
          End If
      Next
    
    End Sub
    so can u
     
    Last edited by a moderator: Aug 20, 2007
  6. vipin.incat

    vipin.incat New Member

    Joined:
    Aug 20, 2007
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
  7. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,293
    Likes Received:
    365
    Trophy Points:
    83
    Help us by having the code block when you have code snippets in your posts.
     

Share This Page